public ActionResult ApplyForm() { if (this.usersService.CanApply(this.UserId)) { CandidateInputModel model = new CandidateInputModel(); model.Specialties = this.specialtiesService.GetAll().To<SpecialtyViewModel>().ToList(); return this.PartialView("_ApplyForm", model); } return new EmptyResult(); }
public ActionResult Apply(CandidateInputModel candidature, HttpPostedFileBase file) { if (file == null || !this.ModelState.IsValid || file.FileName.EndsWith(".exe")) { return this.RedirectToAction("Apply"); } string docName = $"Apply-for-{ candidature.SpecialtyId }-{ DateTime.Now.ToString("yyyy-MMM-dd") }"; string path = this.UserManagement.SaveDocument(file, this.UserId, docName); this.usersService.MakeApply(this.UserId, candidature.SpecialtyId, path); return this.RedirectToAction("Apply"); }