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 <HttpResponseMessage> Put(long id, ContainerTypeSaveModel model)
        {
            if (model != null)
            {
                await containerTypeService.UpdateAsync(id, model);

                return(Success());
            }

            return(Failure("Невозможно изменить пустой элемент"));
        }
Example #4
0
        public async Task <HttpResponseMessage> Post(ContainerTypeSaveModel model)
        {
            if (model != null)
            {
                await containerTypeService.CreateAsync(model);

                return(Success());
            }

            return(Failure("Невозможно добавить пустой элемент"));
        }
Example #5
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();
        }
        /// <summary>
        /// Частичное представление - открытие окна создания
        /// </summary>
        public ActionResult Create()
        {
            var model = new ContainerTypeSaveModel();

            return(PartialView("Partial/Create", model));
        }