예제 #1
0
 public int DeleteUserById(int id)
 {
     using (var db = new companyEntities())
     {
         tblUser user = _mapper.Map <tblUser>(GetUserById(id));
         if (user != null)
         {
             db.Entry(user).State = EntityState.Deleted;
             db.SaveChanges();
             return(1);
         }
         return(0);
     }
 }
예제 #2
0
 public ActionResult Edit([Bind(Include = "id,title,image,des,fullcontent,datetime,keywords,cat")] news news)
 {
     if (Config.getCookie("logged") == "")
     {
         return(RedirectToAction("Login", "Home"));
     }
     if (ModelState.IsValid)
     {
         news.datetime        = DateTime.Now;
         db.Entry(news).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(news));
 }