public ActionResult AddBenefit(ManyToManyVm foodForm) { bool result = false; try { FoodVm food = new FoodVm { FoodId = foodForm.Id }; food.Benefits.Add(new BenefitVm { BenefitId = foodForm.SelectId }); string data = JsonHelper <FoodVm> .Serialize(food); _foodAppService.AddRelations(data); result = true; } catch (Exception ex) { } return(Json(result)); }
public ActionResult PopulateBenefitForFoods(int id) { ManyToManyVm manyToMany = new ManyToManyVm { Id = id, SelectListItems = GetBenefits() }; return(PartialView("_FoodBenefitDdl", manyToMany)); }