public bool RemoveRewardPackage(int?rewardPackageId) { if (rewardPackageId == null) { return(false); } var rewardPackage = GetRewardPackageById(rewardPackageId); if (rewardPackage == null) { return(false); } foreach (var reward in rewardPackage.Rewards.ToList()) { if (!rewardService_.RemoveReward(reward.RewardId)) { return(false); } } context_.Remove(rewardPackage); if (context_.SaveChanges() > 0) { return(true); } return(false); }
public IActionResult Remove(int?id) { var isRewardRemoved = rewardService.RemoveReward(id); if (isRewardRemoved == false) { return(BadRequest()); } return(Json(isRewardRemoved)); }