Exemplo n.º 1
0
        // GET: ApproveDecline
        public ActionResult Index()
        {
            try
            {
                DBManage.DBHandler        dbHandler          = new DBManage.DBHandler();
                Models.StatusMessageModel StatusMessageModel = new Models.StatusMessageModel();
                if (Request.QueryString["action"] != null && Request.QueryString["id"] != null)
                {
                    switch (Request.QueryString["action"])
                    {
                    case "approve":
                        dbHandler.TranscatData("update Sessions set status=1 where id=" + Request.QueryString["id"] + "");
                        StatusMessageModel.Message    = ConfigurationManager.AppSettings["ApprovedMessage"];
                        StatusMessageModel.isApproved = true;
                        return(View("StatusMessage", StatusMessageModel));

                    case "decline":
                        dbHandler.TranscatData("update Sessions set status=2 where id=" + Request.QueryString["id"] + "");
                        StatusMessageModel.Message    = ConfigurationManager.AppSettings["DeclinedMessage"];
                        StatusMessageModel.isApproved = false;
                        return(View("StatusMessage", StatusMessageModel));
                    }
                }
                else
                {
                    return(Content("Error Occoured. Please contact system administrator"));
                }
            }
            catch
            {
                return(Content("Error Occoured. Please contact system administrator"));
            }
            return(Content("Request Processed Succesfully"));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> DeleteSession(int?id)
        {
            var _user = await UserManager.FindByEmailAsync(User.Identity.Name);

            if (id != null && id > 0)
            {
                DBHandler dbHandler = new DBManage.DBHandler();
                dbHandler.TranscatData("delete Sessions where id=" + id + "");
            }
            StudentViewModel model = new StudentViewModel()
            {
                UserId = _user.Id,
                User   = _user
            };

            model.SessionsList = await _sessionService.GetSessionAdminAsync(_user.Id);

            return(View("Index", model));
        }
Exemplo n.º 3
0
        public async Task <ActionResult> ApproveSession(int?id)
        {
            var _user = await UserManager.FindByEmailAsync(User.Identity.Name);

            if (id != null && id > 0)
            {
                DBManage.DBHandler dbHandler = new DBManage.DBHandler();
                dbHandler.TranscatData("update Sessions set status=1 where id=" + id + "");
            }
            TutorViewModel model = new TutorViewModel()
            {
                UserId = _user.Id,
                User   = _user
            };

            model.SessionsList = await _sessionService.GetSessionByTutorIdAsync(_user.Id);

            return(View("Index", model));
        }