UserController.cs change
This commit is contained in:
parent
7b122e160e
commit
6f8cf6dcb4
@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SessionCompanion.Services.Interfaces;
|
||||
using SessionCompanion.ViewModels.UserViewModels;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SessionCompanion.Controllers
|
||||
@ -22,5 +23,17 @@ namespace SessionCompanion.Controllers
|
||||
if (User.Password == password) { return Json(User.Id); }
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
[HttpPost("register")]
|
||||
|
||||
public async Task<IActionResult> Register(UserViewModel model)
|
||||
{
|
||||
if(!ModelState.IsValid)
|
||||
return BadRequest();
|
||||
await _service.Create(model);
|
||||
await _service.SaveAsync();
|
||||
return Ok();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user