public ActionResult PromoteUser() { if (Request.Params.AllKeys.Contains("id")) { long id = 0; try { id = long.Parse(Request.Params["id"]); } catch { } Form_Author_Add form = new Form_Author_Add(id); if (Request.HttpMethod.ToLower() == form.getMethod().ToString()) { if (form.isValid(Request.Form)) { if (this._app.users().promoteUser(form, id)) { _messages.addMessage("The user has been successfully promoted"); return Redirect("/backend/ListUsers"); } else { _messages.addMessage("There was an error while promoting the user"); } } } ViewData["form"] = form.render(); return View(); } else { _messages.addError("Undefined parameter ID"); return RedirectToAction("listUsers", "backend"); } }
public ActionResult EditAuthor() { if (Request.Params.AllKeys.Contains("uid")) { long uid = 0; try { uid = long.Parse(Request.Params["uid"]); } catch { } author edited = this._app.users().getAuthorByUserId(uid); Form_Author_Add form = new Form_Author_Add(uid); form.setEditData(edited); if (Request.HttpMethod.ToLower() == form.getMethod().ToString()) { if (form.isValid(Request.Form)) { if (this._app.users().saveAuthor(form, edited)) { _messages.addMessage("The author has been successfully saved"); return Redirect("/backend/ListUsers"); } else { _messages.addError("There was an error while saving the author"); } } } ViewData["form"] = form.render(); return View(); } else { _messages.addError("Undefined parameter UID"); return RedirectToAction("listUsers", "backend"); } }