public async Task <Customer> CreateAsync(CustomerSaveModel customerModel) { var customer = new Customer(); customerModel.ApplyToEntity(customer, dataStore, positionService); await dataStore.SaveAsync(customer); return(customer); }
public Customer Create(CustomerSaveModel customerModel) { var customer = new Customer(); customerModel.ApplyToEntity(customer, dataStore, positionService); dataStore.Save(customer); return(customer); }
public async Task UpdateAsync(long id, CustomerSaveModel customerModel) { var customer = dataStore.Get <Customer>(id); if (customer == null) { throw new EntityNotFoundException($"Запись типа {typeof(Customer).Name} c идентификатором {id} не существует"); } customerModel.ApplyToEntity(customer, dataStore, positionService); await dataStore.SaveChangesAsync(); }