예제 #1
0
        public async Task <ApiResponse> PostFood([FromBody] ApiResponse model)
        {
            var obj    = JsonConvert.DeserializeObject <List <DeFood> >(model.Payload.ToString());
            var result = BlFood.Save(obj);

            return(result);
        }
예제 #2
0
 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()
     }));
 }
예제 #3
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));
            }
        }
예제 #4
0
        public async Task <ApiResponse> DeleteFood(string code)
        {
            var result = BlFood.Delete(code);

            return(result);
        }
예제 #5
0
        public ApiResponse GetFood(string id)
        {
            var result = BlFood.GetByCode(id);

            return(result);
        }
예제 #6
0
        public ApiResponse GetAllFood(bool isAllowed)
        {
            var result = BlFood.GetAll(isAllowed);

            return(result);
        }