コード例 #1
0
 public ActionResult Edit(Owner owner)
 {
     if (ModelState.IsValid)
     {
         db.Entry(owner).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(owner);
 }
コード例 #2
0
 public ActionResult ChangeAddress(Owner Owner)
 {
     if (ModelState.IsValid)
     {
         db.Entry(Owner).State = EntityState.Modified;
         Owner.GoogleMap = string.IsNullOrEmpty(Owner.Address) ? UserHelper.GetFormattedLocation("", "", "USA") : UserHelper.GetFormattedLocation(Owner.Address, Owner.City, Owner.CountryCode);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(Owner);
 }
コード例 #3
0
        public void RegisterOwner(RegisterModel model)
        {
            var newowner = new  Owner { EmailAddress = model.Email };
            var user = Membership.GetUser(model.UserName);
            if (user != null)
            {
                var providerUserKey = user.ProviderUserKey;
                if (providerUserKey != null)
                    newowner.GUID = (Guid)providerUserKey;
                newowner.FirstName = model.UserName;
                newowner.Photo = "./../images/dotimages/avatar-placeholder.png";
                newowner.GoogleMap = "USA";
            }

            _db.Owners.Add(newowner);
            _db.SaveChanges();

        }