예제 #1
0
        public ActionResult Edit(ItemTypeModel itemTypeModel)
        {
            using (var necessitiesContext = new NecessitiesContext())
            {
                var itemType = necessitiesContext.ItemTypes.First(x => x.ItemTypeId == itemTypeModel.ItemTypeId);

                itemType.Description = itemTypeModel.Description;
                itemType.Active = itemTypeModel.Active;

                necessitiesContext.SaveChanges();
            }

            return RedirectToAction("Index");
        }
예제 #2
0
        public ActionResult Create(ItemTypeModel itemTypeModel)
        {
            using (var necessitiesContext = new NecessitiesContext())
            {
                necessitiesContext.ItemTypes.Add(
                    new ItemType
                        {
                            Description = itemTypeModel.Description,
                            Active = true
                        });

                necessitiesContext.SaveChanges();
            }

            return RedirectToAction("Index");
        }