Пример #1
0
        public ActionResult Unpublish(int NoteID)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Authentication", new { ReturnUrl = @"/Admin/NoteActions/" + NoteID + "/Approve" }));
            }

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

            NoteModel Note = NotesRepository.GetNoteDetailsById(NoteID);

            if (Note == null ? true : Note.Status != 3)
            {
                return(new HttpStatusCodeResult(System.Net.HttpStatusCode.NotFound));
            }

            RejectNoteModel Rn = new RejectNoteModel()
            {
                NoteID       = NoteID,
                NoteCategory = Note.Category,
                NoteTitle    = Note.Title
            };


            return(PartialView("~/Views/Admin/NoteViews/_UnpublishNotePopup.cshtml", Rn));
        }
Пример #2
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"));
            }
        }
Пример #3
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"));
            }
        }