public ActionResult New() { var documentCategories = _db.DocumentCategories.ToList(); var documentTypes = _db.DocumentTypes.ToList(); var apps = _db.Applications.ToList(); var viewModel = new NewDocumentViewModel { Document = new Document(), DocumentCategories = documentCategories, DocumentTypes = documentTypes, Applcations = apps }; return(View("NewOrEdit", viewModel)); }
public async Task <ActionResult> Edit(int id) { var document = await _db.Documents.SingleOrDefaultAsync(x => x.Id.Equals(id)); if (document == null) { return(new HttpNotFoundResult()); } var documentCategories = _db.DocumentCategories.ToList(); var documentTypes = _db.DocumentTypes.ToList(); var apps = _db.Applications.ToList(); var viewModel = new NewDocumentViewModel { Document = document, DocumentCategories = documentCategories, DocumentTypes = documentTypes, Applcations = apps }; return(View("NewOrEdit", viewModel)); }