public async Task <IActionResult> Edit(Address address)
        {
            if (ModelState.IsValid)
            {
                Address oldAddress = addressRepository.GetById(address.AddressId);
                if (oldAddress.Equals(address) && oldAddress.Name == address.Name)
                {
                    return(RedirectToAction("Index"));
                }

                if (oldAddress.Equals(address) && oldAddress.Name != address.Name)
                {
                    oldAddress.Name = address.Name;
                    if (!addressRepository.EditName(oldAddress))
                    {
                        return(BadRequest("could not edit the name"));
                    }
                }

                if (!oldAddress.Equals(address))
                {
                    if (!await addressRepository.Edit(address))
                    {
                        return(BadRequest("could not edit the address"));
                    }
                }


                return(RedirectToAction("Index"));
            }

            return(View(address));
        }            //////////////
        public async Task <ActionResult> Edit(int id, Address address)
        {
            try
            {
                Address oldAddress = addressRepository.GetById(id);
                if (oldAddress == null)
                {
                    return(NotFound());
                }

                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                address.AddressId = oldAddress.AddressId;

                if (oldAddress.Equals(address) && oldAddress.Name == address.Name)
                {
                    return(Ok());
                }

                if (oldAddress.Equals(address) && oldAddress.Name != address.Name)
                {
                    oldAddress.Name = address.Name;
                    if (!addressRepository.EditName(oldAddress))
                    {
                        return(BadRequest("could not edit the name"));
                    }
                }

                if (!oldAddress.Equals(address))
                {
                    if (!await addressRepository.Edit(address))
                    {
                        return(BadRequest("could not edit the address"));
                    }
                }

                return(Ok());
            }
            catch (Exception)
            {
                throw;
            }
        }