public async Task <IActionResult> Edit(int id, Sellers seller)
        {
            if (!ModelState.IsValid)
            {
                var departments = await _departmentService.FindAllAsync();

                var viewModel = new SellerFromViewModel {
                    Seller = seller, Departments = departments
                };
                return(View(viewModel));
            }
            if (id != seller.Id)
            {
                return(RedirectToAction(nameof(Error), new { Message = "Id missmatch" }));
            }
            try
            {
                await _sellerService.UpdateAsync(seller);

                return(RedirectToAction(nameof(Index)));
            }
            catch (ApplicationException e)
            {
                return(RedirectToAction(nameof(Error), new { Message = e.Message }));
            }
        }
        public async Task <IActionResult> Create(Sellers seller)
        {
            if (!ModelState.IsValid)
            {
                var departments = await _departmentService.FindAllAsync();

                var viewModel = new SellerFromViewModel {
                    Seller = seller, Departments = departments
                };
                return(View(viewModel));
            }
            await _sellerService.InsertAsync(seller);

            return(RedirectToAction(nameof(Index)));
        }