示例#1
0
 public Users GetById(string id)
 {
     using (UspaDbEntities db = new UspaDbEntities())
     {
         return(db.Users.FirstOrDefault(u => u.Id == id));
     }
 }
        public ActionResult Create()
        {
            UspaDbEntities db = new UspaDbEntities();

            ViewBag.language_id = new SelectList(languageHandler.All().
                                                 Select(c => new { id = c.id, title = c.title }), "id", "title");
            return(View());
        }
示例#3
0
 public void Delete(Users user)
 {
     using (UspaDbEntities db = new UspaDbEntities())
     {
         if (user != null)
         {
             db.Entry(user).State = System.Data.Entity.EntityState.Deleted;
             db.SaveChanges();
         }
     }
 }
示例#4
0
 public void Add(Users user)
 {
     using (UspaDbEntities db = new UspaDbEntities())
     {
         if (user != null)
         {
             db.Users.Add(user);
             db.SaveChanges();
         }
     }
 }
示例#5
0
        public void Delete(string id)
        {
            using (UspaDbEntities db = new UspaDbEntities())
            {
                Users user = db.Users.FirstOrDefault(u => u.Id == id);

                if (user != null)
                {
                    db.Entry(user).State = System.Data.Entity.EntityState.Deleted;
                    db.SaveChanges();
                }
            }
        }