コード例 #1
0
        public ActionResult Update(DealerAddressVM item)
        {
            Dealer toUpdate = ds.GetByID(item.DealerID);

            toUpdate.Name      = item.Name;
            toUpdate.MainPhone = item.MainPhone;
            toUpdate.AddressID = item.AddressID;

            Address a = adrs.GetByID(item.AddressID);

            a.Street     = item.Street;
            a.PostalCode = item.PostalCode;
            a.CityID     = item.CityID;

            City c = cits.GetByID(item.CityID);

            if (c.Country == null)
            {
                c.CountryID = item.CountryID;
                cits.Update(c);
            }

            adrs.Update(a);
            ds.Update(toUpdate);

            return(RedirectToAction("Index"));
        }