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