Exemplo n.º 1
0
        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());
            }
        }
Exemplo n.º 2
0
 public void Dispose()
 {
     videoService.Dispose();
     GC.SuppressFinalize(this);
 }