public IHttpActionResult UpdateJobDescripsion([FromBody] RepositoryPattern.JobDescription description) { try { if (description == null) { return(BadRequest("Description can't be null or empty")); } JobDescriptionByEmployee employee = new JobDescriptionByEmployee(); Validation validation = new Validation(new UnitOfWork()); employee.CreatedBy = User.Identity.GetUserName(); if (validation.IsValidToUpdateJobDescription(description.Id)) { return(BadRequest("Job description is already confirmed by your supervisor.")); } if (description.Id == Guid.Empty) { return(BadRequest("Job description id can't be empty")); } if (description.KeyAccountabilities == null || description.JobPurposes == null) { return(BadRequest("Job description KeyAccountabilities or JobPurposes can't be empty")); } employee.Save(description); return(Ok("Congrats! Updated successfully!")); } catch (Exception EX_NAME) { return(BadRequest(EX_NAME.ToString())); } }
public IHttpActionResult Save([FromBody] RepositoryPattern.JobDescription description) { try { if (description == null) { return(BadRequest("Description can't be null or empty")); } JobDescriptionByEmployee employee = new JobDescriptionByEmployee(); Validation validation = new Validation(new UnitOfWork()); employee.CreatedBy = User.Identity.GetUserName(); if (validation.HasSetJobDescription(employee.CreatedBy)) { return(BadRequest("You already set a job description.")); } employee.Save(description); return(Ok("Congrats! Save successfully!")); } catch (Exception EX_NAME) { return(BadRequest(EX_NAME.InnerException?.ToString())); } }
public IHttpActionResult Save([FromBody] RepositoryPattern.JobDescription description) { if (description == null) { return(BadRequest("Description can't be null or empty")); } JobDescriptionByEmployee employee = new JobDescriptionByEmployee(); Validation validation = new Validation(new UnitOfWork()); employee.CreatedBy = User.Identity.GetUserName(); if (validation.HasSetJobDescription(employee.CreatedBy)) { return(BadRequest("You already set a job description.")); } ReportToInfo info = validation.GetReportToByEmployeeId(employee.CreatedBy); employee.Save(description); return(Ok("Congrats! Save successfully!")); }