public async Task <IActionResult> Create([Bind("Password,LastName,FirstName,UserName,PhoneNumber,EmailAddress")] Rider rider) { try { if (ModelState.IsValid) { _service.AddRider(rider); return(RedirectToAction(nameof(Index))); } } catch (DbUpdateException /* ex */) { //Log the error (uncomment ex variable name and write a log. ModelState.AddModelError("", "Unable to save changes. " + "Try again, and if the problem persists " + "see your system administrator."); } return(View(rider)); }
public async Task <IActionResult> AddRider([FromBody] DTO.Rider rider) { var result = await riderService.AddRider(rider); return(Ok(result)); }