예제 #1
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));
        }
예제 #2
0
        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));
            }
        }
예제 #3
0
        public JsonResult GetLanguages()
        {
            var obj = BlAppLanguage.GetAll();

            return(Json(obj));
        }