//UPDATE USER public User UpdateUser(User _user) { string hashPass = hashPasword(_user.Pwd); if (_user != null) { _user.Pwd = hashPass; dbContext.Entry(_user).State = EntityState.Modified; dbContext.SaveChanges(); return(_user); } return(null); }
public Favorite DeleteFavorite(int id) { var fav = dbContext.Favorites.FirstOrDefault(x => x.IdFavorite == id); if (fav != null) { dbContext.Entry(fav).State = EntityState.Deleted; dbContext.SaveChanges(); return(fav); } return(null); }