Esempio n. 1
0
 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);
     }
 }
Esempio n. 2
0
 public void Delete(Article model)
 {
     var target = Find(model.ID);
     DB_Service.Remove<Article>(target);
     DB_Service.Commit();
 }
Esempio n. 3
0
        public void Create(Article model)
        {
            DB_Service.Add<Article>(model);

            DB_Service.Commit();
        }