public async Task Delete(ContractDTO dto) { var item = _context.Contracts.FirstOrDefault(o => o.Address == dto.Address && o.Country == dto.Country && o.DateOfBirth == dto.DateOfBirth && o.Gender == dto.Gender && o.SaleDate == dto.SaleDate && o.Name == dto.Name); if (item != null) { _context.Contracts.Remove(item); await _context.SaveChangesAsync(); } }
public async Task Update(ContractDTO dto) { var item = _context.Contracts.FirstOrDefault(o => o.Address == dto.Address && o.Country == dto.Country && o.DateOfBirth == dto.DateOfBirth && o.Gender == dto.Gender && o.SaleDate == dto.SaleDate && o.Name == dto.Name); if (item != null) { item.CoveragePlan = GetCoveragePlan(dto.Country, dto.SaleDate); item.NetPrice = GetNetRate(dto.DateOfBirth, dto.Gender, item.CoveragePlan); await _context.SaveChangesAsync(); } }
public async Task Save(ContractDTO dto) { var contract = new ContractsModel { Address = dto.Address, Country = dto.Country, DateOfBirth = dto.DateOfBirth, Gender = dto.Gender, SaleDate = dto.SaleDate, Name = dto.Name, }; contract.CoveragePlan = GetCoveragePlan(dto.Country, dto.SaleDate); contract.NetPrice = GetNetRate(dto.DateOfBirth, dto.Gender, contract.CoveragePlan); contract.Id = _context.Contracts.Count() + 1; await _context.Contracts.AddAsync(contract); await _context.SaveChangesAsync(); }
public async Task Delete(ContractDTO dto) { await _repository.Delete(dto); }
public Task Update(ContractDTO dto) { throw new NotImplementedException(); }
public async Task Save(ContractDTO dto) { await _repository.Save(dto); }