public async Task <IActionResult> PostEatingGuide([FromBody] DeEatingGuide[] objList) { try { var recipeCode = objList.FirstOrDefault().ID; foreach (var obj in objList) { if (recipeCode != 0) { obj.UpdateDateTime = DateTime.Now; BlEatingGuide.Save(obj); } } return(Ok("Success")); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
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)); }