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()); }
public void Delete(Users user) { using (UspaDbEntities db = new UspaDbEntities()) { if (user != null) { db.Entry(user).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } } }
public void Add(Users user) { using (UspaDbEntities db = new UspaDbEntities()) { if (user != null) { db.Users.Add(user); db.SaveChanges(); } } }
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(); } } }