public Response <Clinic> Post([FromBody] ClinicModel clinic) { var model = _mapper.Map <Clinic>(clinic); var response = _clinicService.Add(model); return(response); }
private async void SaveButton_Click(object sender, RoutedEventArgs e) { Clinic clinic = new Clinic() { Name = NameBox.Text, IdPlace = ((PlaceViewModel)PlaceComboBox.SelectedItem).IdPlace }; DbStatus status = await clinicService.Add(clinic); if (status == DbStatus.SUCCESS) { WindowHelper.WriteMessage(language.AddingSuccess, MessageLabel, true); } else if (status == DbStatus.EXISTS) { WindowHelper.WriteMessage(language.EntityExists, MessageLabel, false); } else if (status == DbStatus.DATABASE_ERROR) { WindowHelper.WriteMessage(language.DatabaseError, MessageLabel, false); } SaveButton.IsEnabled = false; }
public IActionResult Add(Clinic clinic) { var result = _clinicService.Add(clinic); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
private async void SaveButton_Click(object sender, RoutedEventArgs e) { if (IsValidForm()) { DbStatus status = await clinicService.Add(new Clinic() { Name = NameBox.Text, IdPlace = ((PlaceViewModel)PlaceComboBox.SelectedItem).IdPlace }); OperationStatus = StatusHandler.Handle(OperationType.Create, status); Close(); } else { FieldValidation.WriteMessage(ErrorLabel, language.SelectValues); } }