public ActionResult Edit(Customer address)
        {
            var error =
                EditAddressValidator.NotHasZeroErrors(
                    new Address
            {
                City       = address.FavouriteShopCity,
                Country    = address.FavouriteShopCountry,
                StreetText = address.FavouriteShopStreetText,
                Zip        = address.FavouriteShopZip
            },
                    out var errField
                    );

            if (!error && !error && ModelState.IsValid)
            {
                _addressRepository.UpdateFavouriteShop(address);
                return(RedirectToAction("Index"));
            }
            if (errField != null)
            {
                ModelState.AddModelError("FavouriteShop" + errField, "Fehler bei Eingabe des Feldes!");
            }
            return(View(address));
        }
Beispiel #2
0
        public ActionResult Edit(Address address)
        {
            var error = EditAddressValidator.NotHasZeroErrors(address, out var errField);

            if (!error && !error && ModelState.IsValid)
            {
                _addressRepository.Update(address);
                return(RedirectToAction("Index"));
            }
            if (errField != null)
            {
                ModelState.AddModelError(errField, "Fehler bei Eingabe des Feldes!");
            }
            return(View(address));
        }