// GET: ItemElement/Details/5
        public ActionResult Details(int id = 0)
        {
            if (id == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ItemElementViewModel details = itemElementService.GetById(id);

            if (details == null)
            {
                return(HttpNotFound());
            }
            return(View(details));
        }
Exemplo n.º 2
0
        public void Update(ItemElementViewModel itemElementVM)
        {
            var ItemElement = new ItemElement
            {
                ItemElementId          = itemElementVM.ItemElementId,
                ItemElementName        = itemElementVM.ItemElementName,
                CategoryId             = itemElementVM.CategoryId,
                SubCategoryId          = itemElementVM.SubCategoryId,
                SubSubCategoryId       = itemElementVM.SubSubCategoryId,
                SubSubSubCategoryId    = itemElementVM.SubSubSubCategoryId,
                SubSubSubSubCategoryId = itemElementVM.SubSubSubSubCategoryId
            };

            unitOfWork.ItemElementRepository.Update(ItemElement);
            unitOfWork.Save();
        }
        public ActionResult Edit(ItemElementViewModel ItemElementVM)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    // TODO: Add update logic here

                    itemElementService.Update(ItemElementVM);
                    return(RedirectToAction("Index"));
                }
                catch
                {
                    return(View());
                }
            }
            return(View());
        }
        public ActionResult Create(ItemElementViewModel itemElementVM)
        {
            try
            {
                // TODO: Add insert logic here
                if (ModelState.IsValid)
                {
                    itemElementService.Create(itemElementVM);
                    loadAll();
                }


                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }