public ActionResult Create()
        {
            ViewBag.EventCode  = new SelectList(EventRepo.Get(), "id", "Code");
            ViewBag.DesignCode = new SelectList(DesignRequestRepo.Get(), "id", "Code");
            PromotionViewModel model = new PromotionViewModel();

            return(PartialView("_Create", 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));
        }
        //EDIT
        public ActionResult Edit(int id)
        {
            DesignRequestViewModel model = DesignRequestRepo.GetById(id);

            ViewBag.DesignRequest = new SelectList(EventRepo.Get(), "Id", "Code");
            UserViewModel access = DesignApproveRepo.GetIdByName(User.Identity.Name);

            if (access.Role == "Requester" || access.Role == "Admin")
            {
                return(PartialView("_Edit", model));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
        public ActionResult Add()
        {
            UserViewModel            result = SouvenirRequestRepo.GetIdByName(User.Identity.Name);
            SouvenirRequestViewModel model  = new SouvenirRequestViewModel();

            ViewBag.Event      = new SelectList(EventRepo.Get(), "Id", "Code");
            model.Request_By   = result.M_Employee_Id;
            model.Name         = result.Fullname;
            model.Code         = SouvenirRequestRepo.GetNewCode();
            model.Request_Date = DateTime.Now;
            if (result.Role == "Staff" || result.Role == "Admin")
            {
                return(PartialView("_Add", model));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
        //GET : New Product
        public ActionResult Create()
        {
            UserViewModel          result = DesignRequestRepo.GetIdByName(User.Identity.Name);
            DesignRequestViewModel model  = new DesignRequestViewModel();

            model.Request_By      = result.M_Employee_Id;
            model.NameRequest     = result.Fullname;
            model.Code            = DesignRequestRepo.GetNewCode();
            ViewBag.DesignRequest = new SelectList(EventRepo.Get(), "Id", "Code");
            UserViewModel access = DesignApproveRepo.GetIdByName(User.Identity.Name);

            if (access.Role == "Requester" || access.Role == "Admin")
            {
                return(PartialView("_Create", model));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
Beispiel #6
0
 public ActionResult List()
 {
     return(PartialView("_List", EventRepo.Get()));
 }
Beispiel #7
0
 public async Task <ActionResult <IEnumerable <Event> > > Get()
 {
     return(Ok(await _repo.Get()));
 }