public BaseResponse UpdateDebtor(DebtorRequest debtorRequest) { var Response = new BaseResponse(); try { Debtor debtor = UnitOfWork.DebtorRepository.GetById(debtorRequest.Debtor.Id); if (debtor == null) { Response.ErrorMessage = string.Format("Usuario {0} no encontrado", debtorRequest.Debtor.Id); } else { debtor.Name = debtorRequest.Debtor.Name; debtor.Email = debtorRequest.Debtor.Email; debtor.Phone = debtorRequest.Debtor.Phone; UnitOfWork.DebtorRepository.Update(debtor); UnitOfWork.Save(); Response.IsSuccessful = true; } } catch (Exception ex) { Response.IsSuccessful = false; Response.ErrorMessage = ex.Message; } return(Response); }
public BaseResponse InsertDebtor(DebtorRequest debtorRequest) { var Response = new BaseResponse(); try { UnitOfWork.DebtorRepository.Insert(debtorRequest.Debtor.Entity); UnitOfWork.Save(); Response.IsSuccessful = true; } catch (Exception ex) { Response.IsSuccessful = false; Response.ErrorMessage = ex.Message; } return(Response); }