public ActionResult Create([Bind(Include = "LocationId,StoreNumber,City,State,ManagerId")] Location location) { if (ModelState.IsValid) { db.Locations.Add(location); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(location)); }
public ActionResult Create([Bind(Include = "UserId,FirstName,LastName,ResumeFileName")] UserDetail userDetail) { if (ModelState.IsValid) { db.UserDetails.Add(userDetail); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userDetail)); }
public ActionResult Create([Bind(Include = "ApplicationStatusId,StatusName,StatusDescription")] ApplicationStatus applicationStatus) { if (ModelState.IsValid) { db.ApplicationStatuses.Add(applicationStatus); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(applicationStatus)); }
public JsonResult PositionDelete(int id) { //Retrieve that publisher from db Position pos = db.Positions.Find(id); //Remove the publisher db.Positions.Remove(pos); //Save Changes to the DB db.SaveChanges(); //Create a message to send back to the UI as a JSON result var message = $"Deleted Publisher {pos.PositionId} from the database!"; return(Json( new { id = id, message = message })); }
public ActionResult Create([Bind(Include = "ApplicationId,UserId,OpenPositionId,ApplicationDate,ManagerNotes,ApplicationStatusId,ResumeFileName")] Application application, HttpPostedFileBase resumeUpload) { if (ModelState.IsValid) { #region FileUpload string applicationName = "No Resume Submitted"; if (resumeUpload != null) { applicationName = resumeUpload.FileName; string ext = applicationName.Substring(applicationName.LastIndexOf(".")); // return .extension string[] goodExts = new string[] { ".pdf", ".doc" }; if (goodExts.Contains(ext.ToLower())) { applicationName = Guid.NewGuid() + ext; resumeUpload.SaveAs(Server.MapPath("~/Content/uploadedResumes/" + applicationName)); } else { applicationName = "No Resume Submitted"; } } application.ResumeFileName = applicationName; #endregion db.Applications.Add(application); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ApplicationStatusId = new SelectList(db.ApplicationStatuses, "ApplicationStatusId", "StatusName", application.ApplicationStatusId); ViewBag.OpenPositionId = new SelectList(db.OpenPositions, "OpenPositionId", "OpenPositionId", application.OpenPositionId); ViewBag.UserId = new SelectList(db.UserDetails, "UserId", "FirstName", application.UserId); return(View(application)); }
public ActionResult Apply(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OpenPosition openPosition = db.OpenPositions.Find(id); if (openPosition == null) { return(HttpNotFound()); } var userId = User.Identity.GetUserId(); if (userId != null) { string userResume = db.UserDetails.Where(db => db.UserId == userId).FirstOrDefault().ResumeFileName; int newStatus = db.ApplicationStatuses.Where(a => a.StatusName == "New").FirstOrDefault().ApplicationStatusId; Application newApp = new Application(); newApp.ApplicationDate = DateTime.Now; newApp.OpenPosition = openPosition; newApp.UserId = userId; newApp.ResumeFileName = userResume; newApp.ApplicationStatusId = newStatus; db.Applications.Add(newApp); db.SaveChanges(); return(RedirectToAction("Index", "OpenPositions")); } else { return(RedirectToAction("Login", "Account")); } }
public async Task <ActionResult> Register(RegisterViewModel model, HttpPostedFileBase resumeFileName) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { #region Dealing with Custom UserDetails UserDetail newUserDeets = new UserDetail(); newUserDeets.UserId = user.Id; newUserDeets.FirstName = model.FirstName; newUserDeets.LastName = model.LastName; newUserDeets.ResumeFileName = model.ResumeFileName;//--TODO: handle file uploadFsdpEntities #region FileUpload string applicationName = "No Resume Submitted"; if (resumeFileName != null) { applicationName = resumeFileName.FileName; string ext = applicationName.Substring(applicationName.LastIndexOf(".")); // return .extension string[] goodExts = new string[] { ".pdf", ".doc" }; if (goodExts.Contains(ext.ToLower())) { applicationName = Guid.NewGuid() + ext; resumeFileName.SaveAs(Server.MapPath("~/Content/uploadedResumes/" + applicationName)); } else { applicationName = "No Resume Submitted"; } } #endregion Job_Board_Entities db = new Job_Board_Entities(); db.UserDetails.Add(newUserDeets); db.SaveChanges(); #endregion 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(View("DisplayEmail")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }