POS-25 Dodanie ViewModels
This commit is contained in:
parent
dd74f059da
commit
83665f0919
@ -2,6 +2,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Serwer.Infrastructure.DTO;
|
using Serwer.Infrastructure.DTO;
|
||||||
using Serwer.Infrastructure.Services;
|
using Serwer.Infrastructure.Services;
|
||||||
|
using Serwer.Infrastructure.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -20,17 +21,17 @@ namespace Serwer.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("Register")]
|
[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();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("SignIn")]
|
[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);
|
return Ok(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ namespace Serwer.Api
|
|||||||
.ConfigureWebHostDefaults(webBuilder =>
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
{
|
{
|
||||||
webBuilder.UseStartup<Startup>();
|
webBuilder.UseStartup<Startup>();
|
||||||
|
webBuilder.UseUrls("http://localhost:5001");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
"dotnetRunMessages": "true",
|
"dotnetRunMessages": "true",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
"applicationUrl": "http://localhost:5001;https://localhost:5000",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"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