コード例 #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"));
        }
コード例 #2
0
        // GET: Inappropriate
        public async Task <ActionResult> Index()
        {
            try
            {
                DBManage.DBHandler        dbHandler          = new DBManage.DBHandler();
                Models.StatusMessageModel StatusMessageModel = new Models.StatusMessageModel();
                if (Request.QueryString["action"] != null && Request.QueryString["Fromid"] != null & Request.QueryString["Forid"] != null)
                {
                    StatusMessageModel.Message    = ConfigurationManager.AppSettings["InappropriateMessage"];
                    StatusMessageModel.isApproved = true;
                    string emailTo = ConfigurationManager.AppSettings["AdminEmail"];
                    await EmailSender.SendEmailAsync("Inappropriate Complain Message", "Inappropriate Complain Message", emailTo);

                    return(View("StatusMessage", StatusMessageModel));
                }
                else
                {
                    return(Content("Error Occoured. Please contact system administrator"));
                }
            }
            catch
            {
                return(Content("Error Occoured. Please contact system administrator"));
            }
        }
コード例 #3
0
ファイル: SessionController.cs プロジェクト: reddymade/tutor
        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));
        }
コード例 #4
0
ファイル: SessionController.cs プロジェクト: reddymade/tutor
        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));
        }