public bool DeleteUser(int ID) { User deleteUser; deleteUser = (from p in DB.Users select p).FirstOrDefault(); DB.Entry(deleteUser).State = EntityState.Deleted; DB.SaveChanges(); return(true); }
public int UpdatePassenger(int id, Passenger passenger) { try { var passengerfromdb = _db.Passenger.Find(id); passengerfromdb.FirstName = passenger.FirstName; passengerfromdb.LastName = passenger.LastName; passengerfromdb.Phone = passenger.Phone; _db.Entry(passengerfromdb).State = EntityState.Modified; _db.SaveChanges(); return(1); } catch { return(0); } }