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

            containerTypeModel.ApplyToEntity(containerType);

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

            containerTypeModel.ApplyToEntity(containerType);

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