public void UpdateDocumentCategory(DocumentCategoryInfo category) { if (category == null) throw new ArgumentNullException("category"); DataContext.Entry(category).State = EntityState.Modified; DataContext.SaveChanges(); }
public void CreateDocumentCategory(DocumentCategoryInfo category) { if (category == null) throw new ArgumentNullException("category"); DataContext.DocumentCategoryInfoes.Add(category); DataContext.SaveChanges(); }
public ActionResult CreateCategory(DocumentCategoryInfo category) { if (string.IsNullOrEmpty(category.Name)) { ViewBag.Message = "必须指定文档分类名称!"; return View(category); } _documentRepository.CreateDocumentCategory(category); return RedirectToAction("Manage"); }
public ActionResult EditCategory(DocumentCategoryInfo category) { var cat = _documentRepository.GetDocumentCategoryById(category.ID); if (cat == null) return HttpNotFound(); cat.Name = category.Name; cat.Sort = category.Sort; _documentRepository.UpdateDocumentCategory(cat); return RedirectToAction("Manage"); }