public void Delete(int id) { tbluser newUserMaster = contextu.tblusers.Where(obj => obj.ID == id).FirstOrDefault(); contextu.tblusers.Remove(newUserMaster); contextu.SaveChanges(); }
public void Update(tbluser obj) { tbluser newUserMaster = contextu.tblusers.Where(obj1 => obj1.ID == obj.ID).FirstOrDefault(); newUserMaster.firstname = obj.firstname; newUserMaster.lastname = obj.lastname; newUserMaster.passwordHash = obj.passwordHash; newUserMaster.username = obj.username; newUserMaster.role_id = obj.role_id; newUserMaster.phone = obj.phone; newUserMaster.isActive = obj.isActive; contextu.SaveChanges(); }
public int Insert(tbluser obj) { tbluser newUserMaster = new tbluser(); newUserMaster.firstname = obj.firstname; newUserMaster.lastname = obj.lastname; newUserMaster.passwordHash = obj.passwordHash; newUserMaster.username = obj.username; newUserMaster.role_id = obj.role_id; newUserMaster.phone = obj.phone; newUserMaster.isActive = obj.isActive; contextu.tblusers.Add(newUserMaster); contextu.SaveChanges(); return(newUserMaster.ID); }