// **************************************
        // URL: /Account/RegisterNewAdvertiser
        // **************************************
        public ActionResult RegisterNewAdvertiser()
        {
            var model = new AdvertiserVM {
                Advertiser = uow.Advertisers.Crear(),
            };

            return(View(model));
        }
 public ActionResult RegisterNewAdvertiser(AdvertiserVM model)
 {
     if (model.Advertiser != null && model.Latitude != null && model.Longitude != null)
     {
         model.Advertiser.Latitude  = double.Parse(model.Latitude, CultureInfo.InvariantCulture);
         model.Advertiser.Longitude = double.Parse(model.Longitude, CultureInfo.InvariantCulture);
     }
     if (model.IsValid)
     {
         // Attempt to register the user
         var city    = uow.Cities.Lista().SingleOrDefault(c => c.Name == model.City);
         var address = uow.Adresses.Crear();
         address.PostalCode       = model.PostalCode;
         address.Street           = model.Street;
         address.City             = city;
         model.Advertiser.Address = address;
         var user = new CustomMembershipUser("CustomMembershipProvider",
                                             model.Advertiser.UserName,
                                             model.Advertiser.Id,
                                             model.Advertiser.Email,
                                             "",
                                             "",
                                             true,
                                             false,
                                             model.Advertiser.CreateDate,
                                             DateTime.Now,
                                             DateTime.Now,
                                             DateTime.Now,
                                             DateTime.Now)
         {
             Advertiser = model.Advertiser
         };
         var createStatus = MembershipService.CreateUser(user);
         if (createStatus == MembershipCreateStatus.Success)
         {
             FormsService.SignIn(user.UserName, false /* createPersistentCookie */);
             return(RedirectToAction("Index", "AdvertisersManagement"));
         }
         ModelState.AddModelError("", ErrorCodes.ErrorCodeToString(createStatus));
     }
     // If we got this far, something failed, redisplay form
     ModelState.AddModelError("City", "Introduzca su posición en el mapa");
     return(View(model));
 }