Example #1
0
 public ActionResult Edit(Video obj)
 {
     try
     {
         var video = _videoRepository.GetAll().FirstOrDefault(x => x.Name == obj.Name.Trim() && x.ID != obj.ID);
         if (video != null)
         {
             return(Json(new
             {
                 IsSuccess = false,
                 Messenger = "Tên video đã tồn tại",
             }, JsonRequestBehavior.AllowGet));
         }
         _videoRepository.Edit(obj);
         return(Json(new
         {
             IsSuccess = true,
             Messenger = "Cập nhật Video thành công",
         }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         return(Json(new
         {
             IsSuccess = false,
             Messenger = string.Format("Cập nhật Video thất bại")
         }, JsonRequestBehavior.AllowGet));
     }
 }