Esempio n. 1
0
        public ActionResult Create(ASPNetUsers collection)
        {
            try
            {
                // Do not initialize this variable here.
                AspNetUser obj = new AspNetUser();
                obj.Id                   = collection.Id;
                obj.Email                = collection.Email;
                obj.EmailConfirmed       = collection.EmailConfirmed;
                obj.PasswordHash         = collection.PasswordHash;
                obj.PhoneNumberConfirmed = collection.PhoneNumberConfirmed;
                obj.TwoFactorEnabled     = collection.TwoFactorEnabled;
                obj.LockoutEndDateUtc    = collection.LockoutEndDateUtc;
                obj.LockoutEnabled       = collection.LockoutEnabled;
                obj.AccessFailedCount    = collection.AccessFailedCount;
                obj.UserName             = collection.UserName;

                PhoneBookDbEntities db = new PhoneBookDbEntities();
                db.AspNetUsers.Add(obj);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                return(View("Not done", new HandleErrorInfo(ex, "collection", "Create")));
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 public ActionResult Create(ASPNetUsers collection)
 {
     try
     {
         // Do not initialize this variable here.
         AspNetUser obj = new AspNetUser();
         obj.PasswordHash = collection.Password;
         obj.UserName     = collection.UserName;
         obj.Id           = collection.UserID;
         obj.Email        = collection.EmailID;
         PhoneBookDbEntities db = new PhoneBookDbEntities();
         db.AspNetUsers.Add(obj);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         return(View("Error", new HandleErrorInfo(ex, "collection", "Create")));
     }
 }