Exemplo n.º 1
0
        public async Task CreateAsync(ContainerSaveModel containerModel)
        {
            containerModel.Number = GetNextNumber();
            var container = new Container();

            containerModel.ApplyToEntity(container, dataStore, positionService);

            await dataStore.SaveAsync(container);
        }
Exemplo n.º 2
0
        public void Create(ContainerSaveModel containerModel)
        {
            containerModel.Number = GetNextNumber();
            var container = new Container();

            containerModel.ApplyToEntity(container, dataStore, positionService);

            dataStore.Save(container);
        }
Exemplo n.º 3
0
        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();
        }