public ActionResult Create([Bind(Include = "ProductStatusID,ProductStatusName")] ProductStatus productStatus)
        {
            if (ModelState.IsValid)
            {
                db.ProductStatuses.Add(productStatus);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(productStatus));
        }
        public ActionResult Create([Bind(Include = "InvID,InvName")] InvStatu invStatu)
        {
            if (ModelState.IsValid)
            {
                db.InvStatus.Add(invStatu);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(invStatu));
        }
        public JsonResult AjaxDelete(int id)
        {
            Department department = db.Departments.Find(id);

            db.Departments.Remove(department);
            db.SaveChanges();

            string confirmMessage = string.Format("Deleted department '{0}' from the database.", Department.DeptName);

            return(Json(new { id = id, message = confirmMessage }));
        }
Пример #4
0
        public ActionResult Create([Bind(Include = "CustomerID,FirstName,LastName,Address")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
Пример #5
0
        public ActionResult Create([Bind(Include = "TypeID,TypeName")] Type type)
        {
            if (ModelState.IsValid)
            {
                db.Types.Add(type);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(type));
        }
Пример #6
0
        public ActionResult Create([Bind(Include = "VendorID,VendorName,ContactName,PhoneNumber")] Vendor vendor)
        {
            if (ModelState.IsValid)
            {
                db.Vendors.Add(vendor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vendor));
        }
Пример #7
0
        public JsonResult AjaxDelete(int id)
        {
            Origin origin = db.Origins.Find(id);

            db.Origins.Remove(origin);
            db.SaveChanges();

            string confirmMessage = string.Format("Deleted Origin '{0}' from the database.", origin.Origin1);

            return(Json(new { id = id, message = confirmMessage }));
        }
Пример #8
0
        public ActionResult Create([Bind(Include = "SupplierID,CompanyName,City,State,Phone")] Supplier supplier)
        {
            if (ModelState.IsValid)
            {
                db.Suppliers.Add(supplier);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(supplier));
        }
Пример #9
0
        public ActionResult Create([Bind(Include = "MakeID,MakeName")] ProductMake productMake)
        {
            if (ModelState.IsValid)
            {
                db.ProductMakes.Add(productMake);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(productMake));
        }
Пример #10
0
        public ActionResult Create([Bind(Include = "ProductID,ProductName,CategoryID,Size,Price,InStock,UnitsInStock,Condition,Source,SupplierID,ProductImage,Description")] Product product, HttpPostedFileBase productImg)
        {
            if (ModelState.IsValid)
            {
                #region FileUpload

                string imgName = "noImage.png";

                if (productImg != null)
                {
                    imgName = productImg.FileName;

                    string ext = imgName.Substring(imgName.LastIndexOf('.'));

                    string[] validExts = { ".jpeg", ".jpg", ".png" };

                    if (validExts.Contains(ext.ToLower()) && (productImg.ContentLength <= 4194304))//4mb
                    {
                        imgName = Guid.NewGuid() + ext.ToLower();

                        string savePath = Server.MapPath("~/Content/img/shop/");

                        Image convertedImage = Image.FromStream(productImg.InputStream);

                        int maxImgSize = 500;

                        int maxThumbSize = 255;

                        ImageService.ResizeImage(savePath, imgName, convertedImage, maxImgSize, maxThumbSize);
                    }
                    else
                    {
                        imgName = "noImage.png";
                    }

                    product.ProductImage = imgName;
                    #endregion
                }

                db.Products.Add(product);


                db.SaveChanges();



                return(RedirectToAction("Index", "Home"));
            }

            ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "CategoryName", product.CategoryID);

            return(View(product));
        }
Пример #11
0
        public ActionResult Create([Bind(Include = "ModelID,BrandID,ModelName")] ModelCategory modelCategory)
        {
            if (ModelState.IsValid)
            {
                db.ModelCategories.Add(modelCategory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.BrandID = new SelectList(db.Brands, "BrandID", "BrandName", modelCategory.BrandID);
            return(View(modelCategory));
        }
Пример #12
0
        public ActionResult Create([Bind(Include = "EmpID,FirstName,LastName,Position,ReportsTo,DeptID")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DeptID    = new SelectList(db.Departments, "DeptID", "DeptName", employee.DeptID);
            ViewBag.ReportsTo = new SelectList(db.Employees, "EmpID", "FirstName", employee.ReportsTo);
            return(View(employee));
        }
Пример #13
0
        public ActionResult Create([Bind(Include = "ProductID,ProductName,ProductType,Description,Price,ProductImage,VendorID")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ProductType = new SelectList(db.ProductTypes, "ProductType1", "TypeName", product.ProductType);
            ViewBag.VendorID    = new SelectList(db.Vendors, "VendorID", "VendorName", product.VendorID);
            return(View(product));
        }
        public ActionResult Create([Bind(Include = "MovieTVDirectorID,MovieTVID,DirectorID,DirectorOrder")] MovieTVDirector movieTVDirector)
        {
            if (ModelState.IsValid)
            {
                db.MovieTVDirectors.Add(movieTVDirector);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DirectorID = new SelectList(db.Directors, "DirectorID", "FullName", movieTVDirector.DirectorID);
            ViewBag.MovieTVID  = new SelectList(db.MoviesTVs, "MovieTVID", "Title", movieTVDirector.MovieTVID);
            return(View(movieTVDirector));
        }
Пример #15
0
        public ActionResult Create([Bind(Include = "OddityID,OddityName,OriginID,RecoveryDate,Price,OddityStatusID,GenreID,UnitsSold")] Oddity oddity)
        {
            if (ModelState.IsValid)
            {
                db.Oddities.Add(oddity);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.GenreID        = new SelectList(db.Genres, "GenreID", "Genre1", oddity.GenreID);
            ViewBag.OddityStatusID = new SelectList(db.OddityStatus, "OddityStatusID", "Status", oddity.OddityStatusID);
            ViewBag.OddityID       = new SelectList(db.Origins, "OriginID", "Origin1", oddity.OddityID);
            return(View(oddity));
        }
        public ActionResult Create([Bind(Include = "ID,Name,Description,Price,CategoryID,ManufacturerID,ProductStatusID,CandyTypeID,ProductImage")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CandyTypeID     = new SelectList(db.CandyTypes, "ID", "Name", product.CandyTypeID);
            ViewBag.CategoryID      = new SelectList(db.Categories, "ID", "Name", product.CategoryID);
            ViewBag.ManufacturerID  = new SelectList(db.Manufacturers, "ID", "Name", product.ManufacturerID);
            ViewBag.ProductStatusID = new SelectList(db.ProductStatuses, "ID", "Name", product.ProductStatusID);
            return(View(product));
        }
        public ActionResult Create([Bind(Include = "ProductID,Name,Description,CategoryID,ProductStatusID,CalorieCount,Price,IsOnSale,DiscountPercentage,ProductImage")] Product product, HttpPostedFileBase productImage)
        {
            if (ModelState.IsValid)
            {
                #region File Upload
                //we'll use this file if the user does not upload an image
                string file = "NoImage.jpg";

                if (productImage != null)
                {
                    file = productImage.FileName;
                    string   ext      = file.Substring(file.LastIndexOf('.')); //Remember only 1 param in substring means start there and go to the end of the string
                    string[] goodExts = { ".jpeg", ".jpg", ".png", ".gif" };

                    //check that the uploaded file ext is in our approved list
                    //Check that the file is less than 4mb (the default allowed file size by .NET)
                    if (goodExts.Contains(ext.ToLower()) && productImage.ContentLength <= 4194304) // this is the number of bytes in 4mb
                    {
                        //create a new filename with a GUID
                        file = Guid.NewGuid() + ext;

                        #region Resize Image
                        string savePath       = Server.MapPath("~/Content/img/product/"); //Ensure the ending slash here to place it IN the books folder
                        Image  convertedImage = Image.FromStream(productImage.InputStream);

                        int maxImageSize = 500; //full size image WIDTH
                        int maxThumbSize = 100; //thumbnail size image WIDTH

                        ImageService.ResizeImage(savePath, file, convertedImage, maxImageSize, maxThumbSize);


                        #endregion
                    }
                }//end productImage != null
                //no matter what, update the PhotoURL with the value of the file variable. This happens even if they don't upload an image. Grabs the NoImage.png
                product.ProductImage = file;
                #endregion


                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryID      = new SelectList(db.Categories, "CategoryID", "CategoryName", product.CategoryID);
            ViewBag.ProductStatusID = new SelectList(db.ProductStatuses, "ProductStatusID", "StatusName", product.ProductStatusID);
            return(View(product));
        }
Пример #18
0
        public ActionResult Create([Bind(Include = "ProductID,ProductName,Description,CategoryID,ProdStatusID,UnitsSold,Price,ShippingID,DeptID,EmployeeID")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryID   = new SelectList(db.Categories, "CategoryID", "CategoryName", product.CategoryID);
            ViewBag.DeptID       = new SelectList(db.Departments, "DeptID", "DeptName", product.DeptID);
            ViewBag.EmployeeID   = new SelectList(db.Employees, "EmployeeID", "FirstName", product.EmployeeID);
            ViewBag.ProdStatusID = new SelectList(db.ProductStatus, "ProdStatusID", "StatusName", product.ProdStatusID);
            ViewBag.ShippingID   = new SelectList(db.Shippers, "ShippingID", "CompanyName", product.ShippingID);
            return(View(product));
        }
Пример #19
0
        public JsonResult AjaxDelete(int id)
        {
            Brand brand = db.Brands.Find(id);

            db.Brands.Remove(brand);

            db.SaveChanges();

            var message = $"Deleted the following Brand from the database: {brand.BrandName}";

            return(Json(new
            {
                id = id,
                message = message
            }));
        }
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    UserDetail newUserDetail = new UserDetail()
                    {
                        UserID    = user.Id,
                        FirstName = model.FirstName,
                        LastName  = model.LastName
                    };

                    StoreFrontEntities db = new StoreFrontEntities();
                    db.UserDetails.Add(newUserDetail);
                    db.SaveChanges();

                    UserManager.AddToRole(user.Id, "Customer");
                    return(RedirectToAction("Login"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Пример #21
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    //----Custom User Registration---------
                    //By default there is no reference to the database in this controller (all other objects are created using ViewModels).
                    UserDetail newUserDetail = new UserDetail();
                    newUserDetail.UserID    = user.Id;
                    newUserDetail.FirstName = model.FirstName;
                    newUserDetail.LastName  = model.LastName;

                    //Save the UserDetail object to EF and Presist/save to the database
                    StoreFrontEntities ctx = new StoreFrontEntities();
                    ctx.UserDetails.Add(newUserDetail);         //Sends to EF
                    ctx.SaveChanges();                          //Persists/save to the DB

                    UserManager.AddToRole(user.Id, "Customer"); //MVC 2 Account controller for ref



                    return(View("Login"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Пример #22
0
 public JsonResult AjaxDelete(int id)
 {
     //get the publisher from the db
     Seed seed = ctx.Seeds.Find(id);//find only returns one value
                                    //remove the publisher from the EF
     ctx.Seeds.Remove(seed);
     //save the changes to the database
     ctx.SaveChanges();
     //Create a message to send to the user as a jason result
     var message = $"Deleted the following seed from the database: {seed.CommonName}";
     //return the jsonResult
     return Json(new
     {
         id = id,
         message = message
     });
 }
Пример #23
0
        public ActionResult Create([Bind(Include = "MovieTVID,DiscTypeID,RegionCodeID,UPC,TitleTypeID,Title,Description,GenreID,Runtime,MPAARatingID,Price,UnitsSold,ReleaseDate,StudioID,TitleImage,IsSiteFeature,IsOnSaleFeature,TitleStatusID")] MoviesTV moviesTV, HttpPostedFileBase titleCover)
        {
            if (ModelState.IsValid)
            {
                #region File Upload
                string file = "NoImage.png";
                if (titleCover != null)
                {
                    file = titleCover.FileName;
                    string   ext      = file.Substring(file.LastIndexOf('.'));
                    string[] goodExts = { ".jpeg", ".jpg", ".png", ".gif" };
                    //check that the uploaded file ext is in our list of good file extensions
                    if (goodExts.Contains(ext))
                    {
                        //if valid ext, check file size <= 4mb (max by default from ASP.NET)
                        if (titleCover.ContentLength <= 4194304)
                        {
                            //create a new file name using a guid
                            //file = Guid.NewGuid() + ext;

                            #region Resize Image
                            string savePath       = Server.MapPath("~/Content/img/MoviesTV/");
                            Image  convertedImage = Image.FromStream(titleCover.InputStream);
                            int    maxImageSize   = 650;
                            int    maxThumbSize   = 250;
                            ImageUploadUtility.ResizeImage(savePath, file, convertedImage, maxImageSize, maxThumbSize);
                            #endregion
                        }
                    }
                }
                moviesTV.TitleImage = file;
                #endregion
                db.MoviesTVs.Add(moviesTV);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.GenreID       = new SelectList(db.Genres, "GenreID", "GenreName", moviesTV.GenreID);
            ViewBag.StudioID      = new SelectList(db.Studios, "StudioID", "StudioName", moviesTV.StudioID);
            ViewBag.TitleStatusID = new SelectList(db.TitleStatuses, "TitleStatusID", "TitleStatusName", moviesTV.TitleStatusID);
            ViewBag.DiscTypeID    = new SelectList(db.DiscTypes, "DiscTypeID", "DiscTypeName", moviesTV.DiscTypeID);
            ViewBag.TitleTypeID   = new SelectList(db.TitleTypes, "TitleTypeID", "TitleTypeName", moviesTV.TitleTypeID);
            ViewBag.RegionCodeID  = new SelectList(db.RegionCodes, "RegionCodeID", "RegionCodeID", moviesTV.RegionCodeID);
            ViewBag.MPAARatingID  = new SelectList(db.MPAARatings, "MPAARatingID", "Rating", moviesTV.MPAARatingID);
            return(View(moviesTV));
        }
        public ActionResult Create([Bind(Include = "ProductID,ProductName,MaterialID,FitID,InvID,TypeID,SupplierID,UnitsSold,ReleaseDate,ProductImage,Description,SoldAsPair,Price")] Jewelery jewelery, HttpPostedFileBase productCover)
        {
            if (ModelState.IsValid)
            {
                string file = "NoImage.jpg";

                if (productCover != null)
                {
                    file = productCover.FileName;
                    string   ext      = file.Substring(file.LastIndexOf('.'));
                    string[] goodExts =
                    {
                        ".jpg", ".jpeg", ".png", ".gif"
                    };
                    if (goodExts.Contains(ext.ToLower()) && productCover.ContentLength <= 4194304)
                    {
                        //create a new file name using GUID
                        file = Guid.NewGuid() + ext;

                        #region Resize Image
                        string savePath       = Server.MapPath("~/Content/images/products/");
                        Image  convertedImage = Image.FromStream(productCover.InputStream);

                        int maxImageSize = 500;
                        int maxThumbSize = 100;

                        ImageService.ResizeImage(savePath, file, convertedImage, maxImageSize, maxThumbSize);
                        #endregion
                    }
                }
                jewelery.ProductImage = file;//this for now needs to be outside the IF block, because it was manipulating the productCover / file
                //only. it wasn't even touching jewelery.ProductImage yet.

                db.Jeweleries.Add(jewelery);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.FitID      = new SelectList(db.Fits, "FitID", "FitName", jewelery.FitID);
            ViewBag.InvID      = new SelectList(db.InvStatus, "InvID", "InvName", jewelery.InvID);
            ViewBag.MaterialID = new SelectList(db.Materials, "MaterialID", "MaterialName", jewelery.MaterialID);
            ViewBag.SupplierID = new SelectList(db.Suppliers, "SupplierID", "CompanyName", jewelery.SupplierID);
            ViewBag.TypeID     = new SelectList(db.Types, "TypeID", "TypeName", jewelery.TypeID);
            return(View(jewelery));
        }
Пример #25
0
        public ActionResult Create([Bind(Include = "TentID,Name,BrandID,StatusID,ManufacturerID,DimensionsID,CapacityID,TentMaterialID,PoleMaterialID,Price,SeasonID,Weight,isWaterProof,isDiscontinued,Description,ImageURL")] Tent tent, HttpPostedFileBase imageURL)
        {
            if (ModelState.IsValid)
            {
                #region Image Upload
                string imageName = "Placeholder.png";
                if (imageURL != null)
                {
                    imageName = imageURL.FileName;

                    string   ext  = imageName.Substring(imageName.LastIndexOf("."));
                    string[] exts = new string[] { ".jpeg", ".jpg", ".png" };
                    if (exts.Contains(ext.ToLower()) && (imageURL.ContentLength <= 4194304))
                    {
                        imageName = Guid.NewGuid() + ext;
                        string savepath = Server.MapPath("~/Content/img/");
                        //imageURL.SaveAs(Server.MapPath("~/Content/img/"+imageName));
                        Image convertedImage = Image.FromStream(imageURL.InputStream);
                        int   maxImageSize   = 500;
                        ImageService.ResizeImage(savepath, imageName, convertedImage, maxImageSize);
                    }
                    else
                    {
                        imageName = "Placeholder.png";
                    }
                }
                tent.ImageURL = imageName;
                #endregion
                db.Tents.Add(tent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.BrandID        = new SelectList(db.Brands, "BrandID", "BrandName", tent.BrandID);
            ViewBag.CapacityID     = new SelectList(db.Capacities, "CapacityID", "Capacity1", tent.CapacityID);
            ViewBag.DimensionsID   = new SelectList(db.Dimensions, "DimensionID", "DimensionRange", tent.DimensionsID);
            ViewBag.ManufacturerID = new SelectList(db.Manufacturers, "ManufacturerID", "ManufacturerName", tent.ManufacturerID);
            ViewBag.PoleMaterialID = new SelectList(db.PoleMaterials, "PoleMaterialID", "PoleMaterial1", tent.PoleMaterialID);
            ViewBag.SeasonID       = new SelectList(db.Seasons, "SeasonID", "Season1", tent.SeasonID);
            ViewBag.StatusID       = new SelectList(db.StatusIDs, "StatusID1", "Status", tent.StatusID);
            ViewBag.TentMaterialID = new SelectList(db.TentMaterials, "TentMaterialID", "TentMaterial1", tent.TentMaterialID);
            return(View(tent));
        }
Пример #26
0
        public ActionResult Create([Bind(Include = "ProductID,ProductName,Price,UnitsSold,TypeID,MakeID,Model,ProductStatusID,Description,ProductImage,IsFeatured")] Product product, HttpPostedFileBase productImage)
        {
            if (ModelState.IsValid)
            {
                #region File Upload
                string file = "noImage.png";

                if (productImage != null)
                {
                    file = productImage.FileName;

                    string   ext      = file.Substring(file.LastIndexOf('.'));
                    string[] goodExts = { ".jpg", ".jpeg", ".png", ".gif" };

                    if (goodExts.Contains(ext.ToLower()) && productImage.ContentLength <= 5242880)
                    {
                        file = Guid.NewGuid() + ext;

                        #region Resize
                        string savePath = Server.MapPath("~/Content/images/");

                        Image resized = Image.FromStream(productImage.InputStream);

                        int maxImageSize = 400;
                        int maxThumbSize = 100;

                        ImageServices.ResizeImage(savePath, file, resized, maxImageSize, maxThumbSize);

                        #endregion
                    }
                }
                product.ProductImage = file;
                #endregion
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.MakeID          = new SelectList(db.ProductMakes, "MakeID", "MakeName", product.MakeID);
            ViewBag.ProductStatusID = new SelectList(db.ProductStatuses, "ProductStatusID", "ProductStatusName", product.ProductStatusID);
            ViewBag.TypeID          = new SelectList(db.ProductTypes, "TypeID", "TypeName", product.TypeID);
            return(View(product));
        }
        [ValidateAntiForgeryToken]                                          //***LOGO added to database***
        public ActionResult Create([Bind(Include = "ManufacturerID,ManufacturerName,Logo,City,State,Country,Warranty")] Manufacturer manufacturer,
                                   HttpPostedFileBase logo)
        {
            #region FileUpload
            if (ModelState.IsValid)
            {
                string imgName = "noImage.jpg";
                if (logo != null)
                {
                    //get image and assign it to the variable
                    imgName = logo.FileName;

                    //declare and assign ext value from the substring where it will grab after the .
                    string ext = imgName.Substring(imgName.LastIndexOf("."));

                    //make a list of image extensions we will accept here
                    string[] goodExts = { ".jpeg", ".jpg", ".png", ".gif" };

                    if (goodExts.Contains(ext.ToLower()) && (logo.ContentLength <= 4194304))//this is .net 4mb amx
                    {
                        //if it is ok and the extension is in the list we want to rename it with a guid (global unique id)
                        imgName = Guid.NewGuid() + ext;

                        //save it to the webserver
                        logo.SaveAs(Server.MapPath("~Content/images/" + "imgName"));
                    }
                    else
                    {
                        imgName = "noImage.jpg";
                    }
                }
                //no matter which way that ended up we need to add the name to the object
                manufacturer.Logo = imgName;
                #endregion
                db.Manufacturers.Add(manufacturer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(manufacturer));
        }
Пример #28
0
 public ActionResult Register(User user)
 {
     if (ModelState.IsValid)
     {
         user.DateCreated  = DateTime.Now;
         user.IsAdmin      = false;
         user.DateModified = DateTime.Now;
         db.Users.Add(user);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View("Create"));
 }
Пример #29
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    //var code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    //var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    //await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking this link: <a href=\"" + callbackUrl + "\">link</a>");
                    //ViewBag.Link = callbackUrl;

                    //**********USER DETAILS STEP 3 -- make sure to add using statment for DATA LAYER
                    #region dealing with custom user details
                    UserDetail newUserDeets = new UserDetail();
                    newUserDeets.UserID    = user.Id;
                    newUserDeets.FirstName = model.FirstName;
                    newUserDeets.LastName  = model.LastName;
                    newUserDeets.Address   = model.Address;
                    newUserDeets.City      = model.City;
                    newUserDeets.State     = model.State;
                    newUserDeets.Zip       = model.Zip;
                    newUserDeets.Phone     = model.Phone;

                    //newUserDeets.ResumeFile = model.ResumeFile;

                    StoreFrontEntities db = new StoreFrontEntities();
                    db.UserDetails.Add(newUserDeets);
                    db.SaveChanges();

                    #endregion

                    //var code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);

                    //UserManager.AddToRole(user.Id, "Sales");

                    //var trySignIn = await SignInManager.PasswordSignInAsync(user.UserName, model.Password, false, false);
                    return(View("Login"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
        public ActionResult Create([Bind(Include = "GenreID,GenreName")] Genre genre)
        {
            if (ModelState.IsValid)
            {
                db.Genres.Add(genre);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(genre));
        }