public IActionResult AddInterest(string userId, int interestId, string type) { if (type == "TravelAndLife") { var userTravelInterest = new UserTravelInterest { UserId = userId, TravelInterestId = interestId }; userTravelInterestRepository.Create(userTravelInterest); return(Ok()); } else if (type == "HealthAndWellness") { var userHealthInterest = new UserHealthInterest { UserId = userId, HealthInterestId = interestId }; userHealthInterestRepository.Create(userHealthInterest); return(Ok()); } else if (type == "FoodAndDrink") { var userFoodInterest = new UserFoodInterest { UserId = userId, FoodInterestId = interestId }; userFoodInterestRepository.Create(userFoodInterest); return(Ok()); } return(StatusCode(500)); }
public void Create(UserHealthInterest userHealthInterest) { context.UserHealthInterests.Add(userHealthInterest); context.SaveChanges(); }