Пример #1
0
        public async Task <ApiResult> LoadFormAsync(int Id)
        {
            int          ActId = Id;
            var          res   = new Dictionary <string, object>();
            Fct_Activity Model = await dapper.GetByIDAsync <Fct_Activity>(Id);

            res[nameof(ActId)] = ActId;
            res[nameof(Model)] = Model.ToNewByNull();
            return(new ApiResult(StatusCodeEnum.成功, "", res));
        }
        [HttpPost("Save")]//, Core.HZYAppCheckModel
        public async Task <ApiResult> SaveAsync([FromForm] Fct_Activity Model)
        {
            //Member
            var Files = new List <IFormFile>();

            //IFormFile Photo = null;
            if (Request.Form.Files.Count > 0)
            {
                Files = Request.Form.Files.Where(w => w.Name.Contains("Files")).ToList();
                //Photo = Request.Form.Files.FirstOrDefault(w => w.Name == "Photo");
            }


            return(this.ResultOk(await dapper.InsertAsync(Model)));// await this.service.SaveAsync(Model, this.webRootPath, Files));
        }
        [HttpPost("SaveDesign/{Id}")]//, Core.HZYAppCheckModel
        public async Task <ApiResult> SaveDesignAsync(int Id, [FromForm] Fct_Activity Model)
        {
            //Activity
            if (Model == null)
            {
                return(null);
            }
            Model.Design_Introduce = SavaImgReplaceSrc(Model.Design_Introduce);
            var activity = new Fct_Activity()
            {
                ActId = Id, Design_Introduce = Model.Design_Introduce, ModifyTime = Model.ModifyTime
            };
            var Files = new List <IFormFile>();


            IFormFile Photo = null;

            if (Request.Form.Files.Count > 0)
            {
                Files = Request.Form.Files.Where(w => w.Name.Contains("Files")).ToList();
                Photo = Request.Form.Files.FirstOrDefault(w => w.Name == "Photo");
            }
            return(this.ResultOk(await dapper.UpdateAsync <Fct_Activity>(activity)));//, this.webRootPath, null));
        }
 public async Task <ApiResult> FindListAsync(int Page, int Rows, [FromBody] Fct_Activity Search)
 => this.ResultOk(await this.service.FindListAsync(Page, Rows, Search));