예제 #1
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            ProductGroupCustomAction productGroupCustomAction = UnitOfWork.ProductGroupCustomActionRepository.GetById(id);

            UnitOfWork.ProductGroupCustomActionRepository.DeleteById(id);
            UnitOfWork.Save();
            return(RedirectToAction("Index", new { id = productGroupCustomAction.ProductGroupId }));
        }
예제 #2
0
 public ActionResult Edit(ProductGroupCustomAction productGroupCustomAction)
 {
     if (ModelState.IsValid)
     {
         productGroupCustomAction.IsDeleted = false;
         UnitOfWork.ProductGroupCustomActionRepository.Update(productGroupCustomAction);
         UnitOfWork.Save();
         return(RedirectToAction("Index", new { id = productGroupCustomAction.ProductGroupId }));
     }
     ViewBag.CustomActionId = new SelectList(UnitOfWork.CustomActionRepository.Get(), "Id", "Title", productGroupCustomAction.CustomActionId);
     ViewBag.Id             = productGroupCustomAction.ProductGroupId;
     return(View(productGroupCustomAction));
 }
예제 #3
0
        // GET: ProductGroupCustomActions/Delete/5
        public ActionResult Delete(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductGroupCustomAction productGroupCustomAction = UnitOfWork.ProductGroupCustomActionRepository.GetById(id.Value);

            if (productGroupCustomAction == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Id = productGroupCustomAction.ProductGroupId;
            return(View(productGroupCustomAction));
        }
예제 #4
0
        // GET: ProductGroupCustomActions/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductGroupCustomAction productGroupCustomAction = UnitOfWork.ProductGroupCustomActionRepository.GetById(id.Value);

            if (productGroupCustomAction == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CustomActionId = new SelectList(UnitOfWork.CustomActionRepository.Get(), "Id", "Title", productGroupCustomAction.CustomActionId);
            ViewBag.Id             = productGroupCustomAction.ProductGroupId;
            return(View(productGroupCustomAction));
        }
예제 #5
0
        public ActionResult Create(ProductGroupCustomAction productGroupCustomAction, Guid id)
        {
            if (ModelState.IsValid)
            {
                productGroupCustomAction.ProductGroupId = id;
                productGroupCustomAction.IsDeleted      = false;
                productGroupCustomAction.CreationDate   = DateTime.Now;
                productGroupCustomAction.Id             = Guid.NewGuid();
                UnitOfWork.ProductGroupCustomActionRepository.Insert(productGroupCustomAction);
                UnitOfWork.Save();
                return(RedirectToAction("Index", new { id = id }));
            }

            ViewBag.CustomActionId = new SelectList(UnitOfWork.CustomActionRepository.Get(), "Id", "Title", productGroupCustomAction.CustomActionId);
            ViewBag.Id             = id;
            return(View(productGroupCustomAction));
        }
 public ActionResult GetCutAmount(string id, string productGroupId)
 {
     try
     {
         if (id == null || productGroupId == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         Guid customActionId   = new Guid(id);
         Guid productGroupGuid = new Guid(productGroupId);
         ProductGroupCustomAction productGroupCustomAction = UnitOfWork.ProductGroupCustomActionRepository.Get(
             current => current.ProductGroupId == productGroupGuid && current.CustomActionId == customActionId).FirstOrDefault();
         if (productGroupCustomAction == null)
         {
             return(HttpNotFound());
         }
         return(Json(productGroupCustomAction.Amount, JsonRequestBehavior.AllowGet));
     }
     catch (Exception exp)
     {
         return(Json(exp.Message, JsonRequestBehavior.AllowGet));
     }
 }