public async Task <IActionResult> EditWorkArea(WorkAreaEditViewModel model, IFormFile pic)
        {
            var workarea = _workAreaService.GetById(model.Id);

            if (ModelState.IsValid)
            {
                if (pic != null)
                {
                    var extension = Path.GetExtension(pic.FileName);
                    var picName   = _categoryService.GetById(model.CategoryId).Url + extension;
                    var path      = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/img/workarea-cover/" + picName);
                    using var stream = new FileStream(path, FileMode.Create);
                    await pic.CopyToAsync(stream);

                    model.Picture = picName;

                    workarea.Picture = model.Picture;
                }

                workarea.Desciption = model.Description.Replace("&nbsp;", " ");
                workarea.CategoryId = model.CategoryId;

                _workAreaService.Update(workarea);
                return(RedirectToAction("Index", "WorkArea", new { area = "Admin" }));
            }

            return(View());
        }
        public IActionResult EditWorkArea(int id)
        {
            ViewBag.Categories = new SelectList(_categoryService.GetAll(), "Id", "Name");
            var workarea = _workAreaService.GetById(id);
            var model    = new WorkAreaEditViewModel()
            {
                Id          = workarea.Id,
                Description = workarea.Desciption,
                Picture     = workarea.Picture,
                CategoryId  = workarea.CategoryId
            };

            return(View(model));
        }