示例#1
0
 public ActionResult Create(ConTent content)
 {
     if (ModelState.IsValid)
     {
         var  dao = new ConTentDao();
         long id  = dao.Insert(content);
         if (id > 0)
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm mới thất bại");
         }
     }
     SetViewBag();
     return(View());
 }
示例#2
0
 public long Insert(ConTent entity)
 {
     db.ConTents.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }