POS_Sprint_2 #4
@ -2,6 +2,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Serwer.Infrastructure.DTO;
|
||||
using Serwer.Infrastructure.Services;
|
||||
using Serwer.Infrastructure.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -20,17 +21,17 @@ namespace Serwer.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("Register")]
|
||||
public async Task<IActionResult> Register(string email, string name, string surname, string login, string password)
|
||||
public async Task<IActionResult> Register([FromForm]RegisterModel request)
|
||||
{
|
||||
await _userService.RegisterAsync(email, name, surname, login, password);
|
||||
await _userService.RegisterAsync(request.Email, request.Name, request.Surname, request.Login, request.Password);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpPost("SignIn")]
|
||||
public async Task<IActionResult> SignIn(string login, string password)
|
||||
public async Task<IActionResult> SignIn([FromForm]SignInModel request)
|
||||
{
|
||||
var user = await _userService.SignInAsync(login, password);
|
||||
var user = await _userService.SignInAsync(request.Login, request.Password);
|
||||
return Ok(user);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ namespace Serwer.Api
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
webBuilder.UseUrls("http://localhost:5001");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
"dotnetRunMessages": "true",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||
"applicationUrl": "http://localhost:5001;https://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
17
Serwer/Serwer.Infrastructure/ViewModels/RegisterModel.cs
Normal file
17
Serwer/Serwer.Infrastructure/ViewModels/RegisterModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Infrastructure.ViewModels
|
||||
{
|
||||
public class RegisterModel
|
||||
{
|
||||
public string Email { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Surname { get; set; }
|
||||
public string Login { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
14
Serwer/Serwer.Infrastructure/ViewModels/SignInModel.cs
Normal file
14
Serwer/Serwer.Infrastructure/ViewModels/SignInModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Infrastructure.ViewModels
|
||||
{
|
||||
public class SignInModel
|
||||
{
|
||||
public string Login { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user