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