POS_Sprint_2 #4

Merged
s426229 merged 12 commits from POS_Sprint_2 into develop 2020-12-14 19:27:10 +01:00
5 changed files with 38 additions and 5 deletions
Showing only changes of commit 83665f0919 - Show all commits

View File

@ -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);
} }

View File

@ -21,6 +21,7 @@ namespace Serwer.Api
.ConfigureWebHostDefaults(webBuilder => .ConfigureWebHostDefaults(webBuilder =>
{ {
webBuilder.UseStartup<Startup>(); webBuilder.UseStartup<Startup>();
webBuilder.UseUrls("http://localhost:5001");
}); });
} }
} }

View File

@ -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"
} }

View 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; }
}
}

View 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; }
}
}