public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Image,FilterId")] FilterAllowablesModel filterAllowablesModel, IFormFile imageFile)
        {
            if (id != filterAllowablesModel.Id)
            {
                return(NotFound());
            }

            //if (imageFile != null)
            //    filterAllowablesModel.Image = ImageHelper.AddImage(_appEnvironment, imageFile);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(filterAllowablesModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FilterAllowablesModelExists(filterAllowablesModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index), new { id = filterAllowablesModel.FilterId }));
            }

            return(View(filterAllowablesModel));
        }
        public async Task <IActionResult> Create([Bind("Title,Image,FilterId")] FilterAllowablesModel filterAllowablesModel, IFormFile imageFile)
        {
            //if (imageFile != null)
            //    filterAllowablesModel.Image = ImageHelper.AddImage(_appEnvironment, imageFile);
            if (ModelState.IsValid)
            {
                _context.Add(filterAllowablesModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index), new { id = filterAllowablesModel.FilterId }));
            }
            ViewData["FilterId"] = new SelectList(_context.Filters, "Id", "Title");
            ViewBag.Filter       = _context.Filters.Find(filterAllowablesModel.FilterId);
            return(View(filterAllowablesModel));
        }