public ActionResult UpdateJobApplication(JobApplicationRequest request) { try { var jobApplication = jobAppService.GetJobApplication(request.JobAppId); if (jobApplication == null) { return(new BadRequestObjectResult("Invalid job application")); } jobApplication.CompanyName = request.CompanyName; jobApplication.JobTitle = request.JobTitle; jobApplication.Description = request.Description; jobApplication.Status = request.Status; jobApplication.City = request.City; jobApplication.State = request.State; jobApplication.JobPostingURL = request.URLToJobPosting; if (!jobAppService.UpdatejobApplication(jobApplication)) { return(new StatusCodeResult(StatusCodes.Status500InternalServerError)); } else { return(new OkObjectResult(jobApplication)); } } catch { return(new StatusCodeResult(StatusCodes.Status500InternalServerError)); } }
public void UpdateJobApplication() { //Arrange var jobApplication = jas.GetJobApplication("jobtaine.com/jobapplication"); jobApplication.CompanyName = "NotJobtaine"; var actual = jas.UpdatejobApplication(jobApplication); var retrievedApplication = jas.GetJobApplication("jobtaine.com/jobapplication"); Assert.IsTrue(actual); Assert.AreEqual(retrievedApplication.CompanyName, "NotJobtaine"); }