Exemple #1
0
        public async Task <IActionResult> In()
        {
            _context.Insert(new Food()
            {
                Name = "陶子00000"
            });
            IEnumerable <Food> v = await _context.GetAll();

            return(Json(v));
        }
Exemple #2
0
        public async Task <IActionResult> Post(Food formData)
        {
            //图片文件保存
            if (!(formData.PictureText is null))
            {
                foreach (var item in formData.PictureText)
                {
                    item.SaveImgUrl = FileSave(item.ImgFile);
                }
            }
            // 创建日期
            formData.CreateDate = DateTime.Now;
            // 更新日期
            formData.ModifyDate = DateTime.Now;
            //Food seveData = Extensions.Func.ObjToObj<Food, Food>(formData);
            _Food.Insert(formData);
            IEnumerable <Food> data = await _Food.GetAll();

            return(Json(formData));
        }