Example #1
0
        public async Task CreateAsync(ContainerTypeSaveModel containerTypeModel)
        {
            var containerType = new ContainerType();

            containerTypeModel.ApplyToEntity(containerType);

            await dataStore.SaveAsync(containerType);
        }
Example #2
0
        public void Create(ContainerTypeSaveModel containerTypeModel)
        {
            var containerType = new ContainerType();

            containerTypeModel.ApplyToEntity(containerType);

            dataStore.Save(containerType);
        }
Example #3
0
        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();
        }