Exemple #1
0
        // GET: List of SessionType
        public ActionResult Index()
        {
            var service = new SessionTypeService();
            var model   = service.GetSessionTypes();

            return(View(model));
        }
        public ActionResult Edit(int id, SessionEdit model)
        {
            var sessionService  = new SessionTypeService();
            var sessionTypeList = sessionService.GetSessionTypes();

            ViewBag.SessionTypeID = new SelectList(sessionTypeList, "SessionTypeID", "Name", model.SessionTypeID);

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            //if(model.SessionID != id)
            //{
            //    ModelState.AddModelError("", "Id Mismatch");
            //    return View(model);
            //}

            var service = GetSessionService();

            if (service.EditSession(model))
            {
                TempData["Save Result"] = "Your session was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Your session could not be updated.");
            return(View(model));
        }
Exemple #3
0
        public ActionResult Index()
        {
            var sessionTypeService = new SessionTypeService();
            var sessionTypeList    = sessionTypeService.GetSessionTypes();

            ViewBag.SessionTypeID = new SelectList(sessionTypeList, "SessionTypeID", "Name");

            return(View());
        }
Exemple #4
0
        //Edit by Id
        public ActionResult Edit(int id)
        {
            var service = new SessionTypeService();
            var detail  = service.GetSessionTypeByID(id);

            var model = new SessionTypeEdit
            {
                SessionTypeID = detail.SessionTypeID,
                Name          = detail.Name,
                PricePerHour  = detail.PricePerHour
            };

            var sessionService  = new SessionTypeService();
            var sessionTypeList = sessionService.GetSessionTypes();

            ViewBag.SessionTypeID = new SelectList(sessionTypeList, "SessionTypeID", "Name", model.SessionTypeID);

            return(View(model));
        }
        //EDIT
        public ActionResult Edit(int id)
        {
            var service = GetSessionService();
            var detail  = service.GetSessionByID(id);
            var model   = new SessionEdit
            {
                SessionID     = detail.SessionID,
                SessionTypeID = detail.SessionTypeID,
                StartTime     = detail.StartTime,
                EndTime       = detail.EndTime,
                Extras        = detail.Extras
            };

            var sessionService  = new SessionTypeService();
            var sessionTypeList = sessionService.GetSessionTypes();

            ViewBag.SessionTypeID = new SelectList(sessionTypeList, "SessionTypeID", "Name", model.SessionTypeID);

            return(View(model));
        }
Exemple #6
0
        public ActionResult Index(SessionCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = GetSessionService();

            if (service.CreateSession(model))
            {
                return(RedirectToAction("Index", "Session"));
            }

            var sessionService  = new SessionTypeService();
            var sessionTypeList = sessionService.GetSessionTypes();

            ViewBag.SessionTypeID = new SelectList(sessionTypeList, "SessionTypeID", "Name");

            return(View(model));
        }
Exemple #7
0
        public ActionResult Edit(SessionTypeEdit model)
        {
            var sessionService  = new SessionTypeService();
            var sessionTypeList = sessionService.GetSessionTypes();

            ViewBag.SessionTypeID = new SelectList(sessionTypeList, "SessionTypeID", "Name", model.SessionTypeID);

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = new SessionTypeService();

            if (service.EditSessionType(model))
            {
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Session type could not be updated.");
            return(View(model));
        }