public int DeleteCountLikeMicroshop(long idUser, long idMicroshop) { CountLike count = db.CountLikes.SingleOrDefault(x => x.IdMicrosite == idMicroshop && x.IdUser == idUser && x.TypeId == (int)EnumCore.Classification.dem_luot_thich_gh); count.IdMicrosite = null; count.IdUser = null; count.DateLike = null; count.TypeId = null; return(db.SaveChanges()); }
public int AddUserInvite(CountLike count) { var check = db.CountLikes.SingleOrDefault(x => x.TypeId == (int)EnumCore.Classification.moi_user_xem_gh && x.IdUser == count.IdUser && x.IdMicrosite == count.IdMicrosite); if (check != null) { return(1); } else { db.CountLikes.Add(count); return(db.SaveChanges()); } }
public long DeleteSaveFavoriteProductOfUser(long idUser, long idProduct) { CountLike count = db.CountLikes.SingleOrDefault(x => x.IdProduct == idProduct && x.IdUser == idUser && x.TypeId == (int)EnumCore.Classification.dem_luot_thich_sp); if (count != null) { count.IdProduct = null; count.IdUser = null; count.DateLike = null; count.TypeId = null; int success = db.SaveChanges(); return(success); } return(0); }
public int SaveFavoriteProductByUser(CountLike count) { CountLike check = db.CountLikes.FirstOrDefault(x => x.IdMicrosite == null && x.IdProduct == null && x.IdUser == null && x.DateLike == null && x.TypeId == null); if (check != null) { check.IdProduct = count.IdProduct; check.IdUser = count.IdUser; check.DateLike = count.DateLike; check.TypeId = (int)EnumCore.Classification.dem_luot_thich_sp; } else { db.CountLikes.Add(count); } return(db.SaveChanges()); }
public bool CheckUserExistInInvite(CountLike count) { var check = db.CountLikes.Where(x => x.TypeId == (int)EnumCore.Classification.moi_user_xem_gh && x.IdUser == count.IdUser && x.IdMicrosite == count.IdMicrosite).Count(); return(check > 0); }