public JsonResult GetEatingGuideDetailData(string langCode) { return(Json(new { foodList = BlFood.GetAllFood().Where(x => x.IsAllowed && x.LangCode == langCode), sections = BlSection.GetAll().Where(x => x.LangCode == langCode), measurementUnits = BlMeasurementUnit.GetAll() })); }
public JsonResult GetEatingGuideDetail(int id, string langCode) { var result = BlEatingGuideDetail.GetAll().Where(x => x.HeadId == id && x.LangCode == langCode).Select(x => new { x.HeadId, x.FoodCode, x.FoodDescription, BlFoodGroup.GetAll().FirstOrDefault(p => p.ID == x.FoodGroupID && p.LangCode == langCode).FoodGroupDescription, BlSection.GetAll().FirstOrDefault(p => p.ID == x.SectionID && p.LangCode == langCode).SectionDescription, x.LangCode, x.Quantity_MeasurementUnitCode, x.Quantity, QuantityDesc = $"{x.Quantity} {x.Quantity_MeasurementUnitCode}", x.Calories, x.Carbs, x.Protein, x.Fat }); return(Json(result)); }