public async Task <IActionResult> Update([FromBody] EditTypeConsultDto typeConsult) { var listError = ValidPropertiesObject.ObjIsValid(typeConsult); if (listError.Count > 0) { return(await ResponseNullOrEmpty(listError)); } var result = _service.Update(typeConsult); return(await Response(result, _service.Validate())); }
public TypeConsult Update(EditTypeConsultDto type) { var typeConsult = _repository.Get(type.Id); typeConsult.Update(type.Name, type.Description); if (typeConsult.Enabled) { typeConsult.Activate(); } else { typeConsult.Deactivate(); } if (typeConsult.Valid) { _repository.Update(typeConsult); } return(typeConsult); }