예제 #1
0
        public ActionResult Reject(int NoteID, RejectNoteModel Rn)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Authentication", new { ReturnUrl = @"/Admin/NotesInReview" }));
            }

            if (!ModelState.IsValid)
            {
                TempData["Message"] = "Something went wrong";
                return(RedirectToAction("NotesInReview", "Admin"));
            }

            int UserID = Convert.ToInt32(User.Identity.Name);

            if (AdminNoteRepository.RejectNote(NoteID, UserID, Rn.Remarks))
            {
                TempData["Message"] = "Note Rejected";
                return(RedirectToAction("NotesInReview", "Admin"));
            }
            else
            {
                TempData["Message"] = "Rejection of Note failed";
                return(RedirectToAction("NotesInReview", "Admin"));
            }
        }
예제 #2
0
        public ActionResult InReview(int NoteID)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Authentication", new { ReturnUrl = @"/Admin/NoteActions/" + NoteID + "/InReview" }));
            }

            int UserID = Convert.ToInt32(User.Identity.Name);

            int result = AdminNoteRepository.MakeNoteInReview(NoteID, UserID);

            if (result == 1)
            {
                TempData["Message"] = "Note Status Changed To In Review";
            }
            else if (result == -1)
            {
                TempData["Message"] = "Note Is Already In Review";
            }
            else
            {
                TempData["Message"] = "Note Status Change failed";
            }

            return(RedirectToAction("NotesInReview", "Admin"));
        }
예제 #3
0
        public ActionResult PublishedNotes()
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Authentication", new { ReturnUrl = @"/Admin/PublishedNotes" }));
            }

            ViewBag.Title                = "PublishedNotes";
            ViewBag.Authorized           = true;
            ViewBag.LoadAjaxJS           = true;
            ViewBag.LoadValidationScript = true;

            PublishedNotesModel publishedNotes = new PublishedNotesModel();

            publishedNotes.PublishedNotes = AdminNoteRepository.GetPublishedNotes();

            return(View("~/Views/Admin/NoteViews/PublishedNotes.cshtml", publishedNotes));
        }
예제 #4
0
        public ActionResult NotesInReview()
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Authentication", new { ReturnUrl = @"/Admin/NotesInReview" }));
            }

            ViewBag.Title                = "NotesInReview";
            ViewBag.Authorized           = true;
            ViewBag.LoadAjaxJS           = true;
            ViewBag.LoadValidationScript = true;

            AdminNotesInReviewModel Notes = new AdminNotesInReviewModel();

            Notes.NotesInReview = AdminNoteRepository.GetNotesInReviews();

            return(View("~/Views/Admin/NoteViews/NotesInReview.cshtml", Notes));
        }
예제 #5
0
        public ActionResult Unpublish(int NoteID, RejectNoteModel Rn)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Authentication", new { ReturnUrl = @"/Admin/AdminDashBoard" }));
            }

            if (!ModelState.IsValid)
            {
                TempData["Message"] = "Something went wrong";
                return(RedirectToAction("AdminDashBoard", "Admin"));
            }

            int UserID = Convert.ToInt32(User.Identity.Name);

            if (AdminNoteRepository.UnpublishNote(NoteID, UserID, Rn.Remarks))
            {
                TempData["Message"] = "Note Unpublished";

                NoteModel Note = NotesRepository.GetNoteDetailsById(NoteID);

                UserProfileModel Seller = UserRepository.GetUserData(Note.SellerID);

                ViewBag.SellerName = Seller.User.FirstName + " " + Seller.User.LastName;
                ViewBag.NoteTitle  = Note.Title;
                ViewBag.Remarks    = Rn.Remarks;

                SendMail.SendEmail(new EmailModel()
                {
                    EmailTo      = new string[] { Seller.User.Email },
                    EmailSubject = "Sorry! We need to remove your notes from our portal",
                    EmailBody    = this.getHTMLViewAsString("~/Views/Email/NoteUnpublished.cshtml")
                });

                return(RedirectToAction("AdminDashBoard", "Admin"));
            }
            else
            {
                TempData["Message"] = "Unpublication of Note failed";
                return(RedirectToAction("AdminDashBoard", "Admin"));
            }
        }
예제 #6
0
        public ActionResult Approve(int NoteID)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Authentication", new { ReturnUrl = @"/Admin/NoteActions/" + NoteID + "/Approve" }));
            }

            int UserID = Convert.ToInt32(User.Identity.Name);

            if (AdminNoteRepository.ApproveNote(NoteID, UserID))
            {
                TempData["Message"] = "Note Approved.";
            }
            else
            {
                TempData["Message"] = "Note Approval Failed";
            }

            return(RedirectToAction("NotesInReview", "Admin"));
        }
예제 #7
0
        public ActionResult AdminDashboard()
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Authentication", new { ReturnUrl = @"/Admin/AdminDashboard" }));
            }

            ViewBag.Title                = "AdminDashboard";
            ViewBag.Authorized           = true;
            ViewBag.LoadAjaxJS           = true;
            ViewBag.LoadValidationScript = true;

            AdminDashboardModel Dashboard = new AdminDashboardModel();

            Dashboard.NoteInReview = AdminNoteRepository.GetCountNotesInReview();

            Dashboard.Downloads = AdminDownloadRepository.CountNewDownloads();

            Dashboard.NewUsers = AdminUserRepository.CountNewUsers();

            Dashboard.PublishedNotes = AdminNoteRepository.GetPublishedNotes();

            return(View(Dashboard));
        }