示例#1
0
        public ActionResult Edit(int id, WrestlerEdit model)
        {
            if (!ModelState.IsValid)
            {
                var promotionList = new PromotionRepo();
                model.Promotions = promotionList.GetPromotions();

                return(View(model));
            }

            if (model.WrestlerId != id)
            {
                ModelState.AddModelError("", "ID Mismatch");
                return(View(model));
            }

            var service = CreateWrestlerService();

            if (service.UpdateWrestler(model))
            {
                TempData["SaveResult"] = "The wrestler has been updated!";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "The wrestler could not be updated.");
            return(View(model));
        }
        //View Approve
        public ActionResult Approve(int id)
        {
            PromotionViewModel model = PromotionRepo.GetById(id);

            ViewBag.Employee = new SelectList(PromotionRepo.GetStaff(), "Id", "Full_Name");
            UserViewModel currentuser = PromotionRepo.GetIdByName(User.Identity.Name);

            if (model.FlagDesign == "Yes")
            {
                return(PartialView("_Approve", model));
            }
            else
            {
                return(PartialView("_ApproveNo", model));
            }

            if (currentuser.Role == "Admin")
            {
                ViewBag.Employee = new SelectList(EmployeeRepo.Get(), "Id", "FullName");
                return(PartialView("_Approve", PromotionRepo.GetById(id)));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
示例#3
0
        // GET: Create
        public ActionResult Create()
        {
            var model         = new WrestlerCreate();
            var promotionList = new PromotionRepo();

            model.Promotions = promotionList.GetPromotions();
            return(View(model));
        }
        //Get Create 3
        public ActionResult Create3(int eventid)
        {
            UserViewModel model2 = PromotionRepo.GetIdByName(User.Identity.Name);

            ViewBag.EventCode = new SelectList(EventRepo.Get(), "id", "Code");
            PromotionViewModel model = new PromotionViewModel();

            model.RequestBy  = model2.Fullname;
            model.T_Event_Id = eventid;
            return(PartialView("_Create3", model));
        }
        //GET: View Edit
        public ActionResult Edit(int id)
        {
            PromotionViewModel model = PromotionRepo.GetById(id);

            if (model.Flag_Design == "1")
            {
                return(PartialView("_Edit", model));
            }
            else
            {
                return(PartialView("_EditNo", model));
            }
        }
        public ActionResult Approve(PromotionViewModel model)
        {
            UserViewModel model1 = PromotionRepo.GetIdByName(User.Identity.Name);

            model.Approved_By = model1.M_Employee_Id;
            ResultResponse result = PromotionRepo.Approve(model);

            return(Json(new
            {
                success = result.Success,
                entity = model,
                message = result.Message
            }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Create3(PromotionViewModel model, List <PromotionItemFileViewModel> fileModel)
        {
            UserViewModel model2 = PromotionRepo.GetIdByName(User.Identity.Name);

            model.Create_By  = User.Identity.Name;
            model.Request_By = model2.M_Employee_Id;
            ResultResponse result = PromotionRepo.UpdateCreate3(model, fileModel, model.Id);

            return(Json(new
            {
                success = result.Success,
                entity = model,
                message = result.Message
            }, JsonRequestBehavior.AllowGet));
        }
示例#8
0
        private void showProduct(int id)
        {
            List <Model.Promotion> promo = PromotionRepo.getPromo();
            List <Product>         prod  = new List <Product>();
            List <Model.Image>     img   = new List <Model.Image>();

            if (id == 0)
            {
                prod = ProductRepo.getProduct();
                img  = ImageRepo.getImage();
                var list = from p in prod
                           join i in img on p.ProductID equals i.ProductID
                           join z in promo on p.ProductID equals z.ProductID
                           where p != null
                           select new
                {
                    p.ProductID,
                    p.ProductName,
                    p.Price,
                    i.ImageName,
                    z.Discount,
                    newPrice = p.Price - ((p.Price * z.Discount) / 100)
                };
                repeaterPromotion.DataSource = list;
                repeaterPromotion.DataBind();
            }
            else
            {
                prod = ProductRepo.getProductById(id);
                img  = ImageRepo.getImage();
                var list = from p in prod
                           join i in img on p.ProductID equals i.ProductID
                           join z in promo on p.ProductID equals z.ProductID
                           where p != null
                           select new
                {
                    p.ProductID,
                    p.ProductName,
                    p.Price,
                    i.ImageName,
                    z.Discount,
                    newPrice = p.Price - ((p.Price * z.Discount) / 100)
                };
                repeaterPromotion.DataSource = list;
                repeaterPromotion.DataBind();
            }
        }
示例#9
0
        //GET: Edit
        //Possible error on Promo ID
        public ActionResult Edit(int id)
        {
            var service = CreateWrestlerService();
            var detail  = service.GetWrestlerById(id);

            var promotionList = new PromotionRepo();
            var model         = new WrestlerEdit
            {
                WrestlerId  = detail.WrestlerId,
                RingName    = detail.RingName,
                Gender      = detail.Gender,
                PromotionId = detail.PromotionId,
                Wins        = detail.Wins,
                Losses      = detail.Losses,
            };

            model.Promotions = promotionList.GetPromotions();

            return(View(model));
        }
        public ActionResult Create(TitleCreate model)
        {
            if (!ModelState.IsValid)
            {
                var promotionList = new PromotionRepo();
                var wrestlerList  = new WrestlerRepo();
                model.Promotions = promotionList.GetPromotions();
                model.Wrestlers  = wrestlerList.GetWrestlers();
                return(View(model));
            }
            var service = CreateTitleService();

            if (service.CreateTitle(model))
            {
                TempData["SaveResult"] = "Your title has been created!";
                return(RedirectToAction("Index"));
            }
            ;

            ModelState.AddModelError("", "Title could not be created.");

            return(View(model));
        }
示例#11
0
 public ActionResult Edit(PromotionViewModel model, List <PromotionItemViewModel> itemModel, List <PromotionItemFileViewModel> fileModel)
 {
     model.Update_By = User.Identity.Name;
     if (model.Flag_Design == "1")
     {
         ResultResponse result = PromotionRepo.Update(model, itemModel, fileModel);
         return(Json(new
         {
             success = result.Success,
             entity = model,
             message = result.Message
         }, JsonRequestBehavior.AllowGet));
     }
     else
     {
         ResultResponse result2 = PromotionRepo.UpdateCreate3(model, fileModel, model.Id);
         return(Json(new
         {
             success = result2.Success,
             entity = model,
             message = result2.Message
         }, JsonRequestBehavior.AllowGet));
     }
 }
示例#12
0
        //View Design Item, untuk Edit
        public ActionResult EditDesignItem(int id)
        {
            List <PromotionItemViewModel> model = PromotionRepo.GetItemId(id);

            return(PartialView("_EditDesignItem", model));
        }
示例#13
0
 public ActionResult ApproveNo(int id)
 {
     return(PartialView("_ApproveNo", PromotionRepo.GetById(id)));
 }
示例#14
0
 //View Design Item, untuk Approval
 public ActionResult ViewDesignItem(int id)
 {
     return(PartialView("_ViewDesignItem", PromotionRepo.GetItemId(id)));
 }
示例#15
0
 //View Promotion Item File, untuk Approval
 public ActionResult ViewPromotionItemFile(int id)
 {
     return(PartialView("_ViewPromotionItemFile", PromotionRepo.GetIdFile(id)));
 }
示例#16
0
 //View Design, untuk Edit
 public ActionResult EditDesign(int id)
 {
     return(PartialView("_EditDesign", PromotionRepo.GetId(id)));
 }
示例#17
0
 //GET: List
 public ActionResult List()
 {
     return(PartialView("_List", PromotionRepo.Get()));
 }
示例#18
0
        public ActionResult EditList(int id)
        {
            List <PromotionItemFileViewModel> model = PromotionRepo.GetIdFile(id);

            return(PartialView("_EditList", model));
        }
示例#19
0
        //untuk view design request, menu ADD
        public ActionResult DesignReq(int id)
        {
            DesignRequestViewModel model = PromotionRepo.GetDesReq(id);

            return(PartialView("_DesignReq", model));
        }