コード例 #1
0
        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));
            }
        }
コード例 #2
0
        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));
        }