private static MunicipalityTaxScheduleDbModel CreateUpdateModel(IUpdateMunicipalityTaxScheduleRequest request) { return(new MunicipalityTaxScheduleDbModel { Tax = request.MunicipalityTaxSchedule.Tax, TaxScheduleType = request.MunicipalityTaxSchedule.TaxScheduleType, ValidTo = request.MunicipalityTaxSchedule.ValidTo, ValidFrom = request.MunicipalityTaxSchedule.ValidFrom, Municipality = request.MunicipalityTaxSchedule.Municipality }); }
public async Task UpdateMunicipalityTaxSchedule(IUpdateMunicipalityTaxScheduleRequest request) { // TODO Consider use of AutoMapper or eq. to map MunicipalityTaxScheduleDbModel modelToUpdate = CreateUpdateModel(request); IMunicipalityTaxScheduleModel existingModel = await context.Set <MunicipalityTaxScheduleDbModel>().AsNoTracking().Where(RetrieveByKeyPredicate(modelToUpdate)).SingleOrDefaultAsync(); if (existingModel != null) { context.Set <MunicipalityTaxScheduleDbModel>().Update(modelToUpdate); } else { context.Set <MunicipalityTaxScheduleDbModel>().Add(modelToUpdate); } await context.SaveChangesAsync(); }
public virtual async Task UpdateMunicipalityTaxSchedule(IUpdateMunicipalityTaxScheduleRequest request) { await mock.Object.UpdateMunicipalityTaxSchedule(request); }