public ActionResult Update(Guid?id, string Name, HttpPostedFileBase Parvandeh) { try { if (Parvandeh == null) { dc.File_Update(id, Name, null); } else { var _Bytes = new byte[Parvandeh.ContentLength]; Parvandeh.InputStream.Read(_Bytes, 0, Parvandeh.ContentLength); dc.File_Update(id, Name, _Bytes); } return(RedirectToAction("Index")); } catch { ViewBag.Message = "Update failure"; var file = dc.Files.Where(x => x.Id == id).Select(m => new Blog.Models.File { Id = m.Id, Name = m.Name, Type = m.Type, Size = m.Size }).FirstOrDefault(); if (Request.IsAjaxRequest()) { return(PartialView(file)); } return(View(file)); } }
public bool Update(Guid id, string Type, string Name, byte[] Content) { try { dc.File_Update(id, Name, Type, Content); return(true); } catch { return(false); } }