public ActionResult Edit(int id) { var job = _db.JobPostings.Find(id); if (job == null) { return(HttpNotFound()); } var e = new JobEditModel { City = job.City, CompanyName = job.CompanyName, Contact = job.Contact, Education = job.Education, Email = job.Email, Experience = job.Experience, JobId = id, LastDate = job.EndDate, Openings = job.Openings, Requirements = job.Requirements, Salary = job.Salary, Specifications = job.Specifications, Title = job.Title, Url = job.URL }; return(View(e)); }
public bool EditJob(JobEditModel model) { try { var result = unitOfwork.JobsRepo.Get(x => x.Id.Equals(model.JobId)).FirstOrDefault(); if (result != null) { result.CastingExpiryDateUtc = DateTime.ParseExact(model.CastingExpiryDateUtc, "dd/MM/yyyy", new CultureInfo("en-US"), DateTimeStyles.None); result.CastingFromDateUtc = DateTime.ParseExact(model.CastingFromDateUtc, "dd/MM/yyyy", new CultureInfo("en-US"), DateTimeStyles.None); result.CastingToDateUtc = DateTime.ParseExact(model.CastingToDateUtc, "dd/MM/yyyy", new CultureInfo("en-US"), DateTimeStyles.None); result.ContactEmail = model.ContactEmail; result.ContactNumbers = model.ContactNumbers; result.Description = model.Description; result.JobTitle = model.JobTitle; result.ModifiedBy = model.UserId; result.ShootingDateUTC = DateTime.ParseExact(model.ShootingDateUTC, "dd/MM/yyyy", new CultureInfo("en-US"), DateTimeStyles.None); } unitOfwork.JobsRepo.Update(result); return(unitOfwork.Save() > 0); } catch (Exception) { throw; } }
public async Task <IActionResult> JobEdit(JobEditModel announce) { if (ModelState.IsValid) { var success = await _updateData.UpdateJobA(announce); if (success) { return(RedirectToAction("index", "home", new { area = "Admin", findtable = announce.FindTable })); } } return(RedirectToAction("jobedit", "job", new { id = announce.Id })); }
public ActionResult EditJob(JobEditModel model) { if (ModelState.IsValid) { model.UserId = User.Identity.GetUserId(); if (jobServices.EditJob(model)) { return(RedirectToAction("Job")); } return(HttpNotFound()); } model.AddressList.AddRange(dropdownServices.GetAddress()); return(View(model)); }
public ActionResult Edit(JobEditModel request) { var uId = Convert.ToInt32(Session["UserId"]); if (ModelState.IsValid && uId > 0) { var job = _db.JobPostings.Find(request.JobId); if (job == null) { return(HttpNotFound()); } if (job.UserId != uId) { ModelState.AddModelError(string.Empty, "The job is not posted by this user."); return(View(request)); } if (request.LastDate < DateTime.Today) { ModelState.AddModelError(string.Empty, "The end date should be a future date."); return(View(request)); } job.CompanyName = request.CompanyName; job.Title = request.Title; job.Salary = request.Salary; job.Experience = request.Experience; job.Openings = request.Openings; job.Education = request.Education; job.City = request.City; job.Contact = request.Contact; job.Email = request.Email; job.URL = request.Url; job.EndDate = request.LastDate; job.Requirements = request.Requirements; job.Specifications = request.Specifications; _db.SaveChanges(); return(RedirectToAction("Detail", new { id = job.JobId })); } return(View(request)); }
public string CreateJobs([FromBody] JobEditModel jobs) { //We don't have this functionality in Generator return("#123"); }