public ActionResult Edit(long id, string description, string url = null, string referrerUrl = null) { try { var oldVideo = db.GetVideo(id); if (oldVideo.UserName != UserHelper.Instance.CurrentUserName) { return(new HttpStatusCodeResult(405, "Unauthorized text edit")); } db.Dispose(); if (!string.IsNullOrEmpty(url)) { db.Update(id, description, url); } else { db.Update(id, description); } if (!string.IsNullOrEmpty(referrerUrl) && referrerUrl == "AJAX") { return new JsonResult() { Data = new { Status = "OK" } } } ; if (Request.UrlReferrer != null && Request.UrlReferrer.AbsoluteUri != null) { return(new RedirectResult(Request.UrlReferrer.AbsoluteUri)); } return(RedirectToAction("Index", "Manage")); } catch (Exception ex) { Log.Error(ex.Message, ex); return(HttpNotFound()); } }
public void Dispose() { videoService.Dispose(); GC.SuppressFinalize(this); }