public async Task Update(Shippingway obj)
        {
            bool hasAny = await _context.Shippingway.AnyAsync(x => x.Id == obj.Id);

            if (!hasAny)
            {
                throw new NotFoundException("Id not found");
            }
            try
            {
                _context.Update(obj);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException e)
            {
                throw new DbConcurrencyException(e.Message);
            }
        }
        public async Task <IActionResult> Edit(int id, Shippingway Shippingway)
        {
            if (id != Shippingway.Id)
            {
                return(BadRequest());
            }
            try
            {
                await _shippingwayService.Update(Shippingway);

                return(RedirectToAction(nameof(Index)));
            }
            catch (NotFoundException)
            {
                return(NotFound());
            }
            catch (DbConcurrencyException)
            {
                return(BadRequest());
            }
        }
        public async Task <IActionResult> Create(Shippingway shippingway)
        {
            await _shippingwayService.InsertAsync(shippingway);

            return(RedirectToAction(nameof(Index)));
        }
 public async Task InsertAsync(Shippingway obj)
 {
     _context.Add(obj);
     await _context.SaveChangesAsync();
 }