public ActionResult Create(ArticleViewModel model) { if (ModelState.IsValid) { try { Article article = new Article() { AddTime = DateTime.Now, ArticleCode = model.ArticleCode, Content = model.Content, Name = model.Name, LastTime = DateTime.Now }; ArticleService.Create(article); return RedirectToAction("index"); } catch (Exception ex) { ViewBag.Message = ex.Message; return View(model); } } else { return View(model); } }
public void Delete(Article model) { var target = Find(model.ID); DB_Service.Remove<Article>(target); DB_Service.Commit(); }
public void Create(Article model) { DB_Service.Add<Article>(model); DB_Service.Commit(); }