public ActionResult Apply(string Message) { var UserId = User.Identity.GetUserId(); var JobId = (int)Session["JobId"]; // get job id stored in session var check = db.ApplyForJobs.Where(a => a.JobId == JobId && a.UserId == a.UserId).ToList(); if (check.Count < 1) { var job = new ApplyForJob(); job.UserId = UserId; job.JobId = JobId; job.Message = Message; job.ApplyDate = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = "تم التقدم للوظيفة بنجاح"; } else { ViewBag.Result = "المعذرة ، لقد تقدمت لهذه الوظيفة من قبل . قم بإختيار وظيفة أخرى"; } return(View()); }
public ActionResult Apply(string Message) { var UserId = User.Identity.GetUserId(); var JobId = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(x => x.JobId == JobId && x.UserId == UserId).ToList(); if (check.Count < 1) { var job = new ApplyForJob { UserId = UserId, JobId = JobId, Message = Message, ApplyDate = DateTime.Now }; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = "Added Successfully"; } else { ViewBag.Result = "Sorry you Are Already Applied"; } return(View()); }
public ActionResult Apply(ApplyForJob applyForJob) { if (ModelState.IsValid) { var userId = User.Identity.GetUserId(); int jobid = Convert.ToInt16(Session["JobId"]); if (db.ApplyForJob.Where(p => p.UserId == userId && p.JobId == jobid).ToList().Count < 1) { ApplyForJob applyForJob2 = new ApplyForJob(); applyForJob.UserId = userId; applyForJob.JobId = Convert.ToInt16(Session["JobId"]); applyForJob.ApplyDate = DateTime.Now; db.ApplyForJob.Add(applyForJob); db.SaveChangesAsync(); ViewBag.Result = "تم التقديم"; return(RedirectToAction("Index")); } else { ViewBag.Result = "قد تم التقديم سابقا"; } } return(View()); }
public ActionResult Apply(string Message) { var userId = User.Identity.GetUserId(); var jobId = (int)Session["jobid"]; var check = db.ApplyForJobs.Where(a => a.jobId == jobId && a.userId == userId).ToList(); if (check.Count < 1) { var job = new ApplyForJob(); job.userId = userId; job.jobId = jobId; job.Message = Message; job.ApplyDate = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = "you Appled Successfully !"; } else { ViewBag.Result = "you Appled this job !"; } return(View()); }
public ActionResult ApplicationJobEdit(ApplyForJob applyForJob, HttpPostedFileBase uploadedCv) { var userId = User.Identity.GetUserId(); var jobId = (int)Session["JobId"]; var oldCV = Path.Combine(Server.MapPath("~/Uploads"), applyForJob.UserCv); if (ModelState.IsValid) { if (uploadedCv != null) { System.IO.File.Delete(oldCV); string path = Path.Combine(Server.MapPath("~/Uploads"), uploadedCv.FileName); uploadedCv.SaveAs(path); applyForJob.UserCv = uploadedCv.FileName; } applyForJob.JobId = jobId; applyForJob.UserId = userId; applyForJob.ApplyDate = DateTime.Now; _context.Entry(applyForJob).State = EntityState.Modified; _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(applyForJob)); }
public ActionResult Apply(string Message, HttpPostedFileBase PathFile) { var UserId = User.Identity.GetUserId(); var JobId = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(a => a.JobId == JobId && a.UserId == UserId).ToList(); if (check.Count < 1) { string path = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(PathFile.FileName)); PathFile.SaveAs(path); var job = new ApplyForJob(); job.UserId = UserId; job.JobId = JobId; job.Message = Message; job.ApplyDate = DateTime.Now; job.PathFile = "~/Images/" + PathFile.FileName; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = "Added Successfuly !"; } else { ViewBag.Result = "sorry , you have applied to this job before!"; } return(View()); }
public ActionResult Apply(string Message) { var JobId = (int)Session["JobId"]; var UserId = User.Identity.GetUserId(); var searchforjob = db.appliesForJobs.SingleOrDefault(aj => aj.JobId == JobId && aj.UserId == UserId); ApplyForJob apply = new ApplyForJob(); if (searchforjob == null) { apply = new ApplyForJob { UserId = User.Identity.GetUserId(), JobId = JobId, Message = Message, ApplyDate = DateTime.Now }; db.appliesForJobs.Add(apply); db.SaveChanges(); } else { return(Json(false)); } return(Json(true)); }
public ActionResult Apply(string Message, HttpPostedFileBase upload) { var UserId = User.Identity.GetUserId(); var JobId = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(a => a.JobId == JobId && a.UserId == UserId).ToList(); if (check.Count < 1) { var job = new ApplyForJob(); string path = Path.Combine(Server.MapPath("~/Uploads/CV"), upload.FileName); upload.SaveAs(path); job.CV = upload.FileName; job.UserId = UserId; job.JobId = JobId; job.Message = Message; job.Date = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); return(RedirectToAction("Index")); } else { ViewBag.Result = "Vous avez déja postulé à cet emploi"; } return(View()); }
public ActionResult Apply(string Message) { //GetUserID returns id of logged user var UserId = User.Identity.GetUserId(); var JobId = (int)Session["JobId"]; //Check so cant apply for same job more than once var check = db.ApplyForJobs.Where(a => a.JobId == JobId && a.UserId == UserId).ToList(); if (check.Count < 1) { var job = new ApplyForJob(); job.UserId = UserId; job.JobId = JobId; job.Message = Message; job.ApplyDate = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = "Done"; } else { ViewBag.Result = "You Have applied before"; } return(View()); }
public IHttpActionResult DeleteApply(int id) { try { var CurrentUserId = User.Identity.GetUserId(); ApplyForJob ApplyJob = db.ApplyForJobs.Where(x => x.Id == id && x.ApplicantId == CurrentUserId).FirstOrDefault(); if (ApplyJob == null) { return(NotFound()); //return Content(HttpStatusCode.NotFound, "Job with Id " + id.ToString() + " not found to delete"); } var CV = ApplyJob.CV; db.ApplyForJobs.Remove(ApplyJob); db.SaveChanges(); //string fullPath = HttpContext.Current.Request.MapPath("/JobFinderWebSite/Uploads/CV/" + CV); string fullPath = Path.Combine(CVPath, CV); if (System.IO.File.Exists(fullPath)) { System.IO.File.Delete(fullPath); } return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public ActionResult Apply(string message) { var UserId = User.Identity.GetUserId(); var JobId = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(j => j.JobId == JobId && j.UserId == UserId).ToList(); if (check.Count < 1) { var job = new ApplyForJob() { UserId = UserId, JobId = JobId, Message = message, ApplyDate = DateTime.Now }; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Message = "You have successfully applied for this job."; } else { ViewBag.Message = "You have already applied before!"; } return(View()); }
public ActionResult Apply(string Message) { var userId = User.Identity.GetUserId(); var jobId = (int)Session["jobId"]; var check = db.ApplyForJobs.Where(a => a.JobId == jobId && a.UserId == userId).ToList(); if (check.Count < 1) { var Job = new ApplyForJob(); Job.UserId = userId; Job.JobId = jobId; Job.ApplyDate = DateTime.Now; Job.Message = Message; db.ApplyForJobs.Add(Job); db.SaveChanges(); ViewBag.r = "Richiesta inviata"; } else { ViewBag.r = "Sei gia presentato "; } return(View()); }
public ActionResult Apply(string Message, HttpPostedFileBase Upload) { var userId = User.Identity.GetUserId(); var jobId = (int)Session["Job_Id"]; var check = db.ApplyForJobs.Where(a => a.User_Id == userId && a.Job_Id == jobId).ToList(); if (check.Count < 1) { var job = new ApplyForJob(); string path = Path.Combine(Server.MapPath("~/FileUploads"), Upload.FileName); Upload.SaveAs(path); job.File_Id = Upload.FileName; job.User_Id = userId; job.Message = Message; job.Job_Id = jobId; job.ApplyDate = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = "تم اختيار الوظيفه"; } else { ViewBag.Result = "لقد تقدمت لهذه الوظيفه بالفعل "; } return(View()); }
public ActionResult Apply(ApplyForJob job, HttpPostedFileBase CV) { var UserId = User.Identity.GetUserId(); var JobId = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(a => a.JobId == JobId && a.UserId == UserId).ToList(); if (check.Count < 1) { string path = Path.Combine(Server.MapPath("~/Uploads"), CV.FileName); CV.SaveAs(path); //var job = new ApplyForJob(); job.JobId = JobId; job.UserId = UserId; job.Message = job.Message; job.CV = CV.FileName; job.ApplyDate = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.result = "تم الاضافة بنجاح"; } else { ViewBag.result = "المعذرة ,لقد سبق و تقدمت الي الوظيفة"; } return(View()); }
public ActionResult Apply(string message) { var userid = User.Identity.GetUserId(); var jobid = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(a => a.JobId == jobid && a.UserId == userid).ToList(); if (check.Count < 1) { var job = new ApplyForJob() { UserId = userid, JobId = jobid, Message = message, ApplyDate = DateTime.Now }; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.res = "تمت الاضافه بنجاح"; } else { ViewBag.res = "لقد سبق و تقدمت الى نفس الوظيفه"; } return(View()); }
public ActionResult Apply(string Message) { // البيانات ال عايز ابعتها لما يتقدم للوظيفة var UserId = User.Identity.GetUserId(); var jobId = (int)Session["JobID"]; // علشان اتأكد انه مينفعش نفس اليوزر يتقدم لنفس الوظيفة اكتر من مره var check = db.ApplyForJobs.Where(a => a.JobId == jobId && a.UserId == UserId).ToList(); if (check.Count < 1) { var job = new ApplyForJob(); // add values of parameters to properties of ApplForJob Model // ApplyForJob properties = parameters job.UserId = UserId; job.JobId = jobId; job.Message = Message; job.ApplyDate = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.result = "تمت الاضافة بنجاح"; } else { ViewBag.result = "خطأ! لقد تقدمت لنفس الوظيفة من قبل"; } return(View()); }
public ActionResult Apply(string Message) { var UserId = User.Identity.GetUserId(); var JobId = (int)Session["JobId"]; /* إذهب إلي جدول تقديم إلي وظيفة وابحث عن اي عنصر المعرف بتاعه يساوي * معرف الموجود عندي حاليا ومعرف المستخدم يساوي الموجود حاليا * إذا وجد * نفذ الاتي */ var check = db.ApplyForJobs.Where(a => a.JobId == JobId && a.UserId == UserId).ToList(); /* إذا لا يوجد نفذ الاتي */ if (check.Count < 1) { var job = new ApplyForJob(); job.UserId = UserId; job.JobId = JobId; job.Message = Message; job.ApplyDate = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = "تمت الإضافة بـ نجاح"; } else { ViewBag.Result = "المعذرة، لقد سبق وتقدمت إلي نفس الوظيفة"; } return(View()); }
public ActionResult Apply(string message) { var user_id = User.Identity.GetUserId(); var job_id = (int)Session["jobId"]; var check = db.ApplyForJobs.Where(a => a.jobId == job_id && a.userId == user_id).ToList(); if (check.Count < 1) { ApplyForJob job = new ApplyForJob(); job.userId = user_id; job.jobId = job_id; job.message = message; job.ApplayDate = DateTime.Now; job.IsConfirmed = false; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = " تمت عملية التقدم بنجاح"; ViewBag.Color = "Green"; } else { ViewBag.Result = "لقد سبق وتقدمت الى هذه الوظيفة"; ViewBag.Color = null; } return(View()); }
public ActionResult Apply(string Message) { if (ModelState.IsValid) { var UserId = User.Identity.GetUserId(); var JobId = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(a => a.JobId == JobId && a.UserId == UserId); if (check.Count() < 1) { var applyforjob = new ApplyForJob() { Message = Message, ApplyDate = DateTime.Now, UserId = UserId, JobId = JobId }; db.ApplyForJobs.Add(applyforjob); db.SaveChanges(); //ViewBag.Result = "تمت الإضافة بنجاح"; return(RedirectToAction("Index")); } else { ModelState.AddModelError("Result", "لقد تم التقدم إلى هذه الوظيفة من قبل."); ViewBag.Result = "لقد تم التقدم إلى هذه الوظيفة من قبل."; } } return(View(Message)); }
public ActionResult Apply(string message) { var userId = User.Identity.GetUserId(); var jobId = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(a => a.JobId == jobId && a.userId == userId).ToList(); if (check.Count < 1) { var job = new ApplyForJob(); job.userId = userId; job.JobId = jobId; job.Message = message; job.ApplyDate = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = "Sent"; } else { ViewBag.Result = " Sorry, you Apply for this job befor"; } return(View()); }
public ApplyForJobViewModel(ApplyForJob job) { Message = job.Message; DateAdded = job.ApplicationDate; JobId = job.JobId; ApplicatorId = job.ApplicatorId; }
public ActionResult Applay(string Message) { var userId = User.Identity.GetUserId(); var jobId = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(a => a.jobId == jobId && a.UserId == userId).ToList(); if (check.Count < 1) { var applayforJob = new ApplyForJob(); applayforJob.jobId = jobId; applayforJob.Message = Message; applayforJob.UserId = userId; applayforJob.applayDate = DateTime.Now; db.ApplyForJobs.Add(applayforJob); db.SaveChanges(); ViewBag.Result = "Apply succsuffly"; } else { ViewBag.Result = "already Exist"; } return(View()); }
public ActionResult Apply(string Message) { var UserId = User.Identity.GetUserId(); var JobId = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(a => a.JobId == JobId && a.UserId == UserId).ToList(); if (check.Count < 1) { var job = new ApplyForJob(); job.UserId = UserId; job.JobId = JobId; job.Message = Message; job.ApplyDate = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = "تمت الاضافة بنجاح"; } else { ViewBag.Result = "المعذرة لقد سبق التقدم لهذة الوظيفة "; } return(View()); }
public async Task <IActionResult> Apply(int id, [FromBody] ApplyForJob formdata) { // var user = await _userManager.FindByNameAsync(userName); var job = await _repo.GetJob(id); var currentUserId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); var user = await _repo.GetUser(currentUserId, true); var check = _context.ApplyForJob.Where(a => a.JobId == id && a.UserId == user.Id).ToList(); if (check.Count < 1) { var apply = new ApplyForJob { JobId = id, UserId = user.Id, Msg = formdata.Msg, ApplyDate = DateTime.Now, UserName = user.KnownAs, JobTitle = job.JobTitle, }; await _context.ApplyForJob.AddAsync(apply); await _context.SaveChangesAsync(); return(Ok(new JsonResult("The Product was Added Successfully"))); } return(Ok(new JsonResult("The Product was Added Before"))); }
public ActionResult Apply(ApplyForJob applyForJob, HttpPostedFileBase uploadedCv) { var userId = User.Identity.GetUserId(); var jobId = (int)Session["JobId"]; var isAppliedOnceForJob = _context.ApplyForJobs.Where(a => a.JobId == jobId && a.UserId == userId).ToList(); if (isAppliedOnceForJob.Count >= 1) { ViewBag.Result = "You Have Applied Before."; } else { if (ModelState.IsValid) { string path = Path.Combine(Server.MapPath("~/Uploads"), uploadedCv.FileName); uploadedCv.SaveAs(path); var job = new ApplyForJob(); job.JobId = jobId; job.UserId = userId; job.Message = applyForJob.Message; job.ApplyDate = DateTime.Now; job.UserCv = uploadedCv.FileName; _context.ApplyForJobs.Add(job); _context.SaveChanges(); ViewBag.Result = "You Have Applied Successfully."; } else { return(View(applyForJob)); } } return(View()); }
public ActionResult ApplyForJob(ApplyForJob model) { if (!ModelState.IsValid) { var viewModel = new ApplyForJobViewModel { Message = model.Message }; return(View(viewModel)); } model.JobId = (int)Session["jobId"]; model.ApplicatorId = User.Identity.GetUserId(); var checkIfSameUserApplicateForSameJob = _context.ApplyForJob.Where(j => j.ApplicatorId == model.ApplicatorId && j.JobId == model.JobId).ToList(); if (checkIfSameUserApplicateForSameJob.Count >= 1) { ViewBag.message = "Already applied for this job"; return(View()); } model.ApplicationDate = DateTime.Now; _context.ApplyForJob.Add(model); _context.SaveChanges(); ViewBag.message = "Applied Successfully"; return(RedirectToAction("Index", "Job")); }
public ActionResult Apply(string Message) { var UserId = User.Identity.GetUserId(); var JobId = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(a => a.JobId == JobId && a.UserId == UserId).ToList(); if (check.Count < 1) { var job = new ApplyForJob(); job.UserId = UserId; job.JobId = JobId; job.Message = Message; job.ApplyDate = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = "Success"; } else { ViewBag.Result = "sorry you apply to this job before!"; } return(View()); }
public ActionResult Apply(string Message) { var userId = User.Identity.GetUserId(); var jobId = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(a => a.JobsId == jobId && a.UserId == userId).ToList(); if (check.Count() < 1) { ApplyForJob applyForJob = new ApplyForJob { Message = Message, ApplyDate = DateTime.Now, UserId = userId, JobsId = jobId }; db.ApplyForJobs.Add(applyForJob); db.SaveChanges(); return(RedirectToAction("index")); } else { ViewBag.Result = "You have already applied for this job !"; } return(View()); }
public ActionResult Apply(string isApply) { var UserId = User.Identity.GetUserId(); var JobId = (int)Session["JobId"]; var check = db.ApplyForJobs.Where(a => a.JobId == JobId && a.UserId == UserId).ToList(); if (check.Count < 1) { var job = new ApplyForJob(); job.UserId = UserId; job.JobId = JobId; job.ApplyDate = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = "تم التقدم بنجاح!"; } else { ViewBag.Result = "المعذرة لقد سبق وتقدمت الى نفس الوظيفة في وقت سابق!"; } return(View()); }
public ActionResult Apply(string Message) { var us = User.Identity.GetUserId(); if (db.Profiles.Count(p => p.UserId == us) == 0) { return(RedirectToAction("Index")); } var UserId = User.Identity.GetUserId(); var JobId = (int)HttpContext.Session["JobId"];//(int)Session["JobId"]; var check = db.ApplyForJobs.Where(a => a.JobId == JobId && a.UserId == UserId).ToList(); if (check.Count() < 1) { var job = new ApplyForJob(); job.UserId = UserId; job.JobId = JobId; job.Message = Message; job.ApplyDate = DateTime.Now; db.ApplyForJobs.Add(job); db.SaveChanges(); ViewBag.Result = "Successful Apply"; } else { ViewBag.Result = "Sorry, You Already Applied For This"; } return(View()); }