示例#1
0
        public async Task UpdateUploadFile(Guid id, IFormFile file, string title, string detail, float price)
        {
            var slide = await _slideRepository.GetAsync(id);

            UploadFile upload   = new UploadFile();
            string     fileName = upload.ImageUpload(file, _iHostEnvironment);

            slide.Name   = fileName;
            slide.Title  = title;
            slide.Sale   = price;
            slide.Detail = detail;
            await _slideRepository.UpdateAsync(slide);
        }
示例#2
0
        public async Task <SlideDto> CreateUploadFile(IFormFile file, string title, string detail, float price)
        {
            UploadFile upload   = new UploadFile();
            string     fileName = upload.ImageUpload(file, _iHostEnvironment);
            var        slide    = new Slide
            {
                Name   = fileName,
                Title  = title,
                Detail = detail,
                Sale   = price
            };
            await _slideRepository.InsertAsync(slide);

            return(ObjectMapper.Map <Slide, SlideDto>(slide));
        }