Esempio n. 1
0
        public IActionResult AddNewItem(CompanyModel companyModel)
        {
            var entity = new ItemEntity
            {
                Name        = companyModel.Name,
                Description = companyModel.Description,
                IsVisible   = companyModel.IsVisible,
            };

            _dbContext.Add(entity);
            _dbContext.SaveChanges();
            return(Ok());
        }
        public AddNewItemResponse Post(ItemModel model)
        {
            var itemEntity = new ItemEntity()
            {
                Description = model.Description,
                IsVisible   = model.IsVisible,
                Name        = model.Name
            };

            dbContext.Add(itemEntity);
            dbContext.SaveChanges();

            return(new AddNewItemResponse()
            {
                Success = !string.IsNullOrEmpty(model.Name) && !string.IsNullOrEmpty(model.Description)
            });
        }