public JsonResult GetEatingGuide() { foreach (var lang in BlAppLanguage.GetAll()) { if (!BlEatingGuide.GetAll().Any(x => x.LangCode == lang.LangCode)) { BlEatingGuide.Save(new DeEatingGuide { ID = 1, LangCode = lang.LangCode, EatingGuideTitle = "", EatingGuideContent = "", UpdateDateTime = DateTime.Now }); } } var result = BlEatingGuide.GetAll(); return(Json(result)); }
public async Task <IActionResult> PostEatingGuide([FromBody] DeEatingGuideDetail model) { try { model.HeadId = 1; model.UpdateDateTime = DateTime.Now; model.FoodGroupID = BlFood.GetByCode(model.FoodCode, "es").FoodGroupID; foreach (var lang in BlAppLanguage.GetAll()) { model.LangCode = lang.LangCode; model.FoodDescription = BlFood.GetByCode(model.FoodCode, model.LangCode).FoodTitle; BlEatingGuideDetail.Save(model); } return(Ok("Success")); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public JsonResult GetLanguages() { var obj = BlAppLanguage.GetAll(); return(Json(obj)); }