public async Task <ApiResult <Clinic> > Post(Clinic model) { _logger.LogInformation(_localizer["LogMethodCalled", "api/Clinic/Post"]); ApiResult <Clinic> response = await _clinicRepository.Add(model); _logger.LogInformation(_localizer["LogMethodResult", "api/Clinic/Post", response.Deserialize()]); return(response); }
public bool Create(Patient patient) { try { var result = _patientRepository.Add(patient); return(result); } catch (Exception ex) { throw ex; } }
public ActionResult Add(string name) { try { _repository.Add(name); return(RedirectToAction(nameof(List))); } catch { return(View()); } }
public bool Create(Appointment appointment) { try { var result = ValidateCreation(appointment) ? _appointmentRepository.Add(appointment) : false; return(result); } catch (Exception ex) { throw ex; } }
public ActionResult Create([Bind(Include = "Clinic1,ID")] Clinic clinic) { try { if (ModelState.IsValid) { repository.Add(clinic); return(RedirectToAction("Index")); } return(View(clinic)); } catch (Exception ex) { //If an exception is thrown, log the error and return null. log.Error(string.Format("An error has been encountered creating the clinic {0}. Exception Message: {1} ", clinic.ID, ex)); return(null); } }