Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("AttributGrpId,Name,Attr_type,ProductGroupId")] AttributGrp attributGrp)
        {
            if (id != attributGrp.AttributGrpId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _attributeGrpService.Edit(attributGrp);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!await _attributeGrpService.AttributeGrpExistence(attributGrp.AttributGrpId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductGroupId"] = new SelectList(await _productGroupService.ProductGroups(), "ProductGroupId", "AliasName", attributGrp.ProductGroupId);
            return(View(attributGrp));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "AttributGrpId,Name,ProductGroupId,Attr_type")] AttributGrp attributGrp)
 {
     if (ModelState.IsValid)
     {
         _attributeGrpService.Edit(attributGrp);
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductGroupId = new SelectList(_productGroupService.ProductGroups(), "ProductGroupId", "GroupTitle", attributGrp.ProductGroupId);
     return(View(attributGrp));
 }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("AttributGrpId,Name,Attr_type,ProductGroupId")] AttributGrp attributGrp)
        {
            if (ModelState.IsValid)
            {
                await _attributeGrpService.Add(attributGrp);

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductGroupId"] = new SelectList(await _productGroupService.ProductGroups(), "ProductGroupId", "AliasName", attributGrp.ProductGroupId);
            return(View(attributGrp));
        }
Beispiel #4
0
        // GET: Admin/AttributGrps/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AttributGrp attributGrp = _attributeGrpService.GetById(id);

            if (attributGrp == null)
            {
                return(HttpNotFound());
            }
            return(View(attributGrp));
        }
Beispiel #5
0
        // GET: Admin/AttributGrps/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AttributGrp attributGrp = _attributeGrpService.GetById(id);

            if (attributGrp == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ProductGroupId = new SelectList(_productGroupService.ProductGroups(), "ProductGroupId", "GroupTitle", attributGrp.ProductGroupId);
            return(PartialView(attributGrp));
        }
Beispiel #6
0
 public void Edit(AttributGrp attributGrp)
 {
     _unitOfWork.AttributGrpRepository.Update(attributGrp);
     _unitOfWork.Save();
 }
Beispiel #7
0
 public void Delete(AttributGrp attributGrp)
 {
     _unitOfWork.AttributGrpRepository.Delete(attributGrp);
     _unitOfWork.Save();
 }
Beispiel #8
0
 public void Add(AttributGrp attributGrp)
 {
     _unitOfWork.AttributGrpRepository.Insert(attributGrp);
     _unitOfWork.Save();
 }