public IActionResult Post([FromBody] Doctor doc) { var newDocID = _doctorRepo.Add(doc); var newDoc = _doctorRepo.Get(newDocID); return(Created($"api/<DoctorContoller>/{newDocID}", newDoc)); }
public IActionResult Create(DoctorViewModel model) { _logger.LogInfo($"Zapytanie do metody Create()", new { model }); if (!ModelState.IsValid) { return(View(model)); } var entity = Mapper.Map <Doctor>(model); var result = _doctorRepo.Add(entity); if (result.IsSuccess) { return(RedirectToIndex()); } AddLocalError(result.FailureMessage); return(View(model)); }