public IActionResult CreateClinic([FromBody] Clinic clinic) { if (clinic == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var createdClinic = _ClinicRepository.AddClinic(clinic); return(Created("clinic", createdClinic)); }
public ActionResult AddClinic(AddEditClinicViewModel addClinic) { if (ModelState.IsValid) { // add clinic var clinic = Mapper.Map <AddEditClinicViewModel, Clinic>(addClinic); var created = _clinicRepository.AddClinic(clinic); if (created) { return(RedirectToAction("Index")); } return(HttpNotFound()); } else { return(View()); } }