public void Delete(NonValidatedPartnershipRecord record) { NonValidatedPartnershipRecord single = GetSingle(record.Id); if (single != null) { _repository.Delete(single); } }
public HttpResponseMessage Post(string email, string phone, int month, int year, string arm, decimal amount) { Partner partnerByEmailAndPhone = this._partnerService.GetPartnerByEmailAndPhone(email, phone); if (partnerByEmailAndPhone == null) { return new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent("Partner with credentials does not exist.") }; } PartnershipArm single = this._partnershipArmService.GetSingle(arm); if (single == null) { return new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent("Selected partnership arm does not exist at this time.") }; } Currency currency = this._currencyService.GetDefault(); if (currency == null) { return new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent("Partner with credentials does not exist.") }; } var record = new NonValidatedPartnershipRecord { Amount = amount, Currency = currency.Id, DateCreated = DateTime.Now, Partner = partnerByEmailAndPhone.Id, Month = month, PartnershipArm = single.Id, Year = year }; try { this._recordsPersistenceService.Create(record); return new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent("Record Logged successfully") }; } catch (Exception) { return new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent("Error saving record! Try again later") }; } }
public void Create(NonValidatedPartnershipRecord record) { _repository.Insert(record); }