public override Result Delete(PatientModel model) { try { Patient patient = _mapper.Map <Patient>(model); _patientDAL.Delete(patient); return(_patientDAL.Save()); } catch (Exception error) { return(Result.BuildError("Erro ao deletar o registro de paciente", error)); } }
public ProcessResult Delete(int id) { ProcessResult processResult = new ProcessResult(); DAL.Extensions.DataBaseResult result = _patientDal.Delete(id); switch (result) { case DAL.Extensions.DataBaseResult.Success: processResult.Result = Extensions.BLLResult.Success; processResult.Errors.Add(Extensions.SuccessProcess); break; case DAL.Extensions.DataBaseResult.Referanced: processResult.Result = Extensions.BLLResult.Referanced; processResult.Errors.Add("Silinmeye çalışılan hasta başka işlemlerle ilişkili olduğundan silinemedi"); break; case DAL.Extensions.DataBaseResult.NotFound: processResult.Result = Extensions.BLLResult.NotFound; processResult.Errors.Add(Extensions.NotFound); break; case DAL.Extensions.DataBaseResult.Error: processResult.Result = Extensions.BLLResult.InnerException; processResult.Errors.Add(Extensions.InnerException); break; case DAL.Extensions.DataBaseResult.ServerDisable: processResult.Result = Extensions.BLLResult.ServerDisable; processResult.Errors.Add(Extensions.ServerDisable); break; case DAL.Extensions.DataBaseResult.AlreadyFound: break; default: throw new ArgumentOutOfRangeException(); } return(processResult); }