Ejemplo n.º 1
0
        public ActionResult Create(ExpertCreateViewModel expertVM)
        {
            if (ModelState.IsValid)
            {
                var localExperts1 = new LocalExperts1()
                {
                    BU_FEIN       = expertVM.BU_FEIN,
                    Email         = expertVM.Email,
                    Business_Name = expertVM.Business_Name,
                    Location_Zip  = expertVM.Location_Zip,
                    Name          = expertVM.Name,
                    Name_JobType  = expertVM.Name_JobType,
                    Phone_Number  = expertVM.Phone_Number,

                    JobTypes1 = new List <JobTypes1>()
                };

                foreach (var JobTypeId in expertVM.JobTypes1)

                {
                    localExperts1.JobTypes1.Add(db.JobTypes1.Find(JobTypeId));
                }



                db.LocalExperts1.Add(localExperts1);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.TotalJobTypes = new MultiSelectList(db.JobTypes1.ToList(), "JobType_ID", "Name_JobType");


            return(View(expertVM));
        }
        public ActionResult Create([Bind(Include = "LocalExpert_ID,LocalExpert_UserID,Name,Email,Business_Name,Name_JobType,BU_FEIN,Location_Zip,Phone_Number")] LocalExperts1 localExperts1)
        {
            if (ModelState.IsValid)
            {
                db.LocalExperts1.Add(localExperts1);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(localExperts1));
        }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "JobType_ID,Name_JobType")] JobTypes1 jobTypes1)
        {
            if (ModelState.IsValid)
            {
                db.JobTypes1.Add(jobTypes1);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(jobTypes1));
        }
        public ActionResult Create(LocalBusinessUsers1 localBusinessUsers1)
        {
            if (ModelState.IsValid)
            {
                db.LocalBusinessUsers1.Add(localBusinessUsers1);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(localBusinessUsers1));
        }
        public async Task <ActionResult> RegisterExpert(RegisterExpertViewModel 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 localExpert = new LocalExperts1()
                    {
                        BU_FEIN            = model.BU_FEIN,
                        Business_Name      = model.BusinessName,
                        Email              = model.Email,
                        LocalExpert_UserID = user.Id,
                        Location_Zip       = model.Location_Zip,
                        Name         = model.Name,
                        Phone_Number = model.Phone_Number,
                        Name_JobType = model.Name_JobType
                    };

                    UserManager.AddToRole(user.Id, "LocalExpert");

                    db.LocalExperts1.Add(localExpert);
                    db.SaveChanges();

                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string 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 <a href=\"" + callbackUrl + "\">here</a>");

                    //General Email Sender....
                    var subject = "welcome to GotAGuy";
                    var body    = $"Hi! Thank you for signing up. We Couldn't Be Happier For You To Be With Us!";

                    MessageSender.SendEmail(model.Email, subject, body);

                    return(RedirectToAction("Login", "Account"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
        public ActionResult Create([Bind(Include = "Review_ReferenceID,LocalBusiness_ID,LocalExpert_UserID,FairPrice_Rating,Quality_Rating,CompletionTime_Rating,Review_Body,ReviewBody_Date")] UserReviews1 userReviews1)
        {
            if (ModelState.IsValid)
            {
                userReviews1.ReviewBody_Date = DateTime.Now;



                db.UserReviews1.Add(userReviews1);
                db.SaveChanges();
                return(RedirectToAction("Details", "LocalExperts1", new { id = userReviews1.LocalExpert_UserID }));
            }

            return(View(userReviews1));
        }