示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            AttributItem attributItem = _attributeItemService.GetById(id);

            _attributeItemService.Delete(attributItem);
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
        public async Task <IActionResult> Edit(int id, [Bind("AttributItemId,Name,value,idfilter,AttributGrpId")] AttributItem attributItem)
        {
            if (id != attributItem.AttributItemId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _attributeItemService.Edit(attributItem);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!await _attributeItemService.AttributeItemsExistence(attributItem.AttributItemId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index), new { id = attributItem.AttributGrpId }));
            }
            ViewData["AttributGrpId"] = new SelectList(await _attributeGrpService.GetAll(), "AttributGrpId", "Name", attributItem.AttributGrpId);
            return(View(attributItem));
        }
示例#3
0
 public ActionResult Edit(AttributItem attributItem)
 {
     if (ModelState.IsValid)
     {
         _attributeItemService.Edit(attributItem);
         return(RedirectToAction("Index/" + attributItem.AttributGrpId));
     }
     ViewBag.AttributGrpId = new SelectList(_attributeGrpService.GetAllAttributeGrp(), "AttributGrpId", "Name", attributItem.AttributGrpId);
     return(View(attributItem));
 }
示例#4
0
        public ActionResult Create(AttributItem attributItem)
        {
            if (ModelState.IsValid)
            {
                _attributeItemService.Add(attributItem);
                return(RedirectToAction("Index/" + Url.RequestContext.RouteData.Values["id"]));
            }

            ViewBag.AttributGrpId = new SelectList(_attributeGrpService.GetAllAttributeGrp(), "AttributGrpId", "Name", attributItem.AttributGrpId);
            return(View(attributItem));
        }
        public async Task <IActionResult> Create([Bind("AttributItemId,Name,value,idfilter,AttributGrpId")] AttributItem attributItem)
        {
            if (ModelState.IsValid)
            {
                await _attributeItemService.Add(attributItem);

                return(RedirectToAction(nameof(Index), new { id = attributItem.AttributGrpId }));
            }
            ViewData["AttributGrpId"] = new SelectList(await _attributeGrpService.GetAll(), "AttributGrpId", "Name", attributItem.AttributGrpId);
            return(View(attributItem));
        }
示例#6
0
        // GET: Admin/AttributItems/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AttributItem attributItem = _attributeItemService.GetById(id);

            if (attributItem == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(attributItem));
        }
示例#7
0
        // GET: Admin/AttributItems/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AttributItem attributItem = _attributeItemService.GetById(id);

            if (attributItem == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AttributGrpId = new SelectList(_attributeGrpService.GetAllAttributeGrp(), "AttributGrpId", "Name", _attributeItemService.GetByAttrGrpId(id));
            return(PartialView(attributItem));
        }
示例#8
0
 public void Edit(AttributItem attributItem)
 {
     attributItem.idfilter = attributItem.idfilter.Replace(" ", "");
     _unitOfWork.AttributItemRepository.Update(attributItem);
     _unitOfWork.Save();
 }
示例#9
0
 public void Delete(AttributItem attributItem)
 {
     _unitOfWork.AttributItemRepository.Delete(attributItem);
     _unitOfWork.Save();
 }
示例#10
0
 public void Add(AttributItem attributItem)
 {
     attributItem.idfilter = attributItem.idfilter.Replace(" ", "");
     _unitOfWork.AttributItemRepository.Insert(attributItem);
     _unitOfWork.Save();
 }