Пример #1
0
        public ActionResult Create([Bind(Include = "UserId,FirstName,LastName,ResumeFilename")] UserDetail userDetail, HttpPostedFileBase resume)
        {
            if (ModelState.IsValid)
            {
                string resumeName = "noPDF.pdf";
                if (resume != null)
                {
                    resumeName = resume.FileName;

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

                    string goodExt = ".pdf";

                    if (goodExt.Contains(ext.ToLower()) && (resume.ContentLength <= 4194304))
                    {
                        resumeName = Guid.NewGuid() + ext;

                        resume.SaveAs(Server.MapPath("~/Content/resumes/" + resumeName));
                    }
                    else
                    {
                        resumeName = "noPDF.pdf";
                    }
                }
                userDetail.ResumeFilename = resumeName;

                db.UserDetails.Add(userDetail);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(userDetail));
        }
Пример #2
0
        public ActionResult OneClickApply(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OpenPosition openPosition = db.OpenPositions.Find(id);

            if (openPosition == null)
            {
                return(HttpNotFound());
            }

            string      currentUserID = User.Identity.GetUserId();
            Application app           = new Application();

            app.OpenPositionId    = openPosition.OpenPositionId;
            app.UserId            = currentUserID;
            app.ApplicationDate   = DateTime.Now;
            app.ApplicationStatus = 2;
            UserDetail userDeets = db.UserDetails.Where(x => x.UserId == currentUserID).Single();

            app.ResumeFilename = userDeets.ResumeFilename;

            db.Applications.Add(app);
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Пример #3
0
        public ActionResult Create([Bind(Include = "ApplicationStatusId,StatusName,StatusDescription")] ApplicationStatus applicationStatus)
        {
            if (ModelState.IsValid)
            {
                db.ApplicationStatus1.Add(applicationStatus);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(applicationStatus));
        }
Пример #4
0
        public ActionResult Create([Bind(Include = "PositionId,Title,JobDescription")] Position position)
        {
            if (ModelState.IsValid)
            {
                db.Positions.Add(position);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(position));
        }
Пример #5
0
        public ActionResult Create([Bind(Include = "LocationId,StoreNumber,City,State,ManagerId")] Location location)
        {
            if (ModelState.IsValid)
            {
                db.Locations.Add(location);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ManagerId = new SelectList(db.UserDetails, "UserId", "FullName", location.ManagerId);
            return(View(location));
        }
Пример #6
0
        public ActionResult Create([Bind(Include = "ApplicationId,OpenPositionId,UserId,ApplicationDate,ManagerNotes,ApplicationStatus,ResumeFilename")] Application application)
        {
            if (ModelState.IsValid)
            {
                db.Applications.Add(application);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ApplicationStatus = new SelectList(db.ApplicationStatus1, "ApplicationStatusId", "StatusName", application.ApplicationStatus);
            ViewBag.OpenPositionId    = new SelectList(db.OpenPositions, "OpenPositionId", "OpenPositionId", application.OpenPositionId);
            ViewBag.UserId            = new SelectList(db.UserDetails, "UserId", "FirstName", application.UserId);
            return(View(application));
        }
Пример #7
0
        public async Task <ActionResult> Register(RegisterViewModel model, HttpPostedFileBase resume)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    UserManager.AddToRole(user.Id, "Employee");

                    string resumeName = "noPDF.pdf";
                    if (resume != null)
                    {
                        resumeName = resume.FileName;

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

                        string goodExt = ".pdf";

                        if (goodExt.Contains(ext.ToLower()) && (resume.ContentLength <= 4194304))
                        {
                            resumeName = Guid.NewGuid() + ext;

                            resume.SaveAs(Server.MapPath("~/Content/resumes/" + resumeName));
                        }
                        else
                        {
                            resumeName = "noPDF.pdf";
                        }
                    }

                    UserDetail newUserDetails = new UserDetail();
                    newUserDetails.UserId         = user.Id;
                    newUserDetails.FirstName      = model.FirstName;
                    newUserDetails.LastName       = model.LastName;
                    newUserDetails.ResumeFilename = resumeName;

                    TechMeetEntities db = new TechMeetEntities();
                    db.UserDetails.Add(newUserDetails);
                    db.SaveChanges();

                    //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;
                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }