Esempio n. 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);
        }
 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()
     }));
 }
        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));
            }
        }
Esempio n. 4
0
        public async Task <ApiResponse> DeleteFood(string code)
        {
            var result = BlFood.Delete(code);

            return(result);
        }
Esempio n. 5
0
        public ApiResponse GetFood(string id)
        {
            var result = BlFood.GetByCode(id);

            return(result);
        }
Esempio n. 6
0
        public ApiResponse GetAllFood(bool isAllowed)
        {
            var result = BlFood.GetAll(isAllowed);

            return(result);
        }