public async Task <ActionResult> BlockApp(long id) { using (var db2 = new ReviewAppsEntities()) { if (ModerationLogics.BlockApp(id, true, db2)) { return(View("Done")); } } return(HttpNotFound()); }
public ActionResult Moderate(AppModerateViewModel model) { App app; ApplicationUser developerUser; bool isFeaturedPreviously; if (!GetTempData(out app, out developerUser, out isFeaturedPreviously)) { // if app not found return(RedirectToAction("Index")); } SetTempData(app, developerUser, isFeaturedPreviously); model.App = app; if (app != null) { ViewBag.user = developerUser; if (app.IsBlocked != model.IsBlocked) { // needs to update if (model.IsBlocked) { ModerationLogics.BlockApp(model.AppId, true, db); } else { ModerationLogics.UnBlockApp(model.AppId, true, db); } } if (isFeaturedPreviously != model.IsFeatured) { // needs to update ModerationLogics.AppFeatured(model.AppId, model.IsFeatured, true, db); } var statusMessage = "You have successfully moderated '" + app.AppName + "' app."; if (!string.IsNullOrWhiteSpace(model.Message)) { SendEmailToAppDeveloper(developerUser, model); statusMessage += " An email is also sent!"; } AppVar.SetSavedStatus(ViewBag, statusMessage); return(View(model)); } AppVar.SetErrorStatus(ViewBag, "Sorry last transaction has been failed."); return(View(model)); }