Пример #1
0
        public IActionResult Add([FromForm(Name = ("Image"))] IFormFile file, [FromForm] Images images)
        {
            var result = _imagesService.Add(file, images);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
        public HttpResponseMessage Add([FromBody] GetImageRequest request)
        {
            BaseViewModel viewModel = new BaseViewModel();

            try
            {
                int count = _imagesService.Add(request);
                if (count == 0)
                {
                    viewModel.BusinessStatus = 1;
                }
                else
                {
                    viewModel.BusinessStatus = 10002;
                    viewModel.StatusMessage  = "添加图片失败";
                }
            }
            catch (Exception)
            {
                viewModel.BusinessStatus = 10002;
                viewModel.StatusMessage  = "添加图片异常";
            }
            return(viewModel.ResponseToJson());
        }