public IActionResult Register([FromBody] RegisterViewModel vm) { var user = new Users(); user.Login = vm.Login; user.BirthDate = vm.BirthDate; user.Pass = vm.Password; user.FirstName = vm.FullName; user.Phone = vm.PhoneNumber; db.Users.Add(user); db.Entry(user).State = Microsoft.EntityFrameworkCore.EntityState.Added; db.SaveChanges(); return(Json(new { success = true })); }
public IActionResult AcceptRequest([FromBody] AcceptRequestViewModel vm) { var user = GetUser(); if (user == null) { return new UnauthorizedResult(); } var request = db.RouteRequest.FirstOrDefault(rr => rr.RequestId == vm.RequestId); request.Status = 1; db.Entry(request).State = EntityState.Modified; db.SaveChanges(); return Json(new { message = "Success" }); }