// GET: Document/Edit/5 public ActionResult Edit(int id) { DocumentService repo = new DocumentService(); Document dc = repo.Get(id); DocumentEditForm documents = new DocumentEditForm(dc); return(View(documents)); }
public ActionResult Edit(int id, DocumentEditForm collection) { try { // TODO: Add update logic here if (ModelState.IsValid) { DocumentService dc = new DocumentService(); Document newDoc = new Document() { Id = collection.Id, Name = collection.Name, Description = collection.Description, Extention = collection.Extention, EmployeeId = collection.EmployeeId, FileBinId = collection.FileBinId, OldFileId = collection.OldFileId, CreateDate = collection.ModifiedDate, Size = collection.Size }; if (dc.Update(newDoc)) { RedirectToAction("Index"); } else { return(View(collection)); } } return(RedirectToAction("Index")); } catch { return(View()); } }