public bool JobPostUpdate(JobPostUpdate jobPostUpdate) { var entity = _ctx.JobPosts.Single(j => j.JobPostId == jobPostUpdate.JobPostId && j.EmployerId == _userId.ToString()); entity.JobPostId = jobPostUpdate.JobPostId; entity.JobTitle = jobPostUpdate.JobTitle; entity.Content = jobPostUpdate.Content; entity.StateName = jobPostUpdate.StateName; entity.IsAwarded = jobPostUpdate.IsAwarded; entity.ModifiedDate = DateTimeOffset.UtcNow; entity.FreelancerId = jobPostUpdate.FreelancerId; return(_ctx.SaveChanges() == 1); }
public IHttpActionResult Put(JobPostUpdate jobPost) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateJobPostService(); if (!service.JobPostUpdate(jobPost)) { return(InternalServerError()); } return(Ok()); }