SES-84 Created User registration method #27

Merged
s426134 merged 3 commits from SES-84 into master 2020-12-13 17:07:56 +01:00
Showing only changes of commit 6f8cf6dcb4 - Show all commits

View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SessionCompanion.Services.Interfaces; using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.UserViewModels;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace SessionCompanion.Controllers namespace SessionCompanion.Controllers
@ -22,5 +23,17 @@ namespace SessionCompanion.Controllers
if (User.Password == password) { return Json(User.Id); } if (User.Password == password) { return Json(User.Id); }
return BadRequest(); 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();
}
} }
} }