Example #1
0
        public async Task <IActionResult> Details(Panel entity, IFormFile file)
        {
            var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\img", file.FileName);

            using (var stream = new FileStream(path, FileMode.Create))
            {
                await file.CopyToAsync(stream);
            }

            entity.Image = file.FileName;

            if (ModelState.IsValid)
            {
                _panelRepository.UptadePanel(entity);

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(entity));
            }
        }