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

            _db.Agents.Add(newagent);
            _db.SaveChanges();

        }