public void Save(Obligation obligation) { Contract.Requires<ArgumentNullException>(obligation.IsNotNull()); this.gangsterBankUnitOfWork.ObligationsRepository.CreateOrUpdate(obligation); }
public void SaveObligation(ObligationViewModel model) { Obligation obligation; if (model.ObligationId != 0) obligation = this.clientProfileService.GetClientObligation(model.ObligationId); else obligation = new Obligation(); obligation.CompanyName = model.CompanyName; obligation.OutstandingAmount = model.OutstandingAmount; obligation.MontlyPayments = model.MonthlyPayments; obligation.ExpirationDate = model.ExpirationDate ?? DateTime.Now; obligation.DelayAmount = model.DelayAmount; if (obligation.Id == 0) { Client client = this.clientProfileService.GetClient(model.ClientId); client.Obligations.Add(obligation); } this.clientProfileService.Save(obligation); }