public async Task <IActionResult> GetOneVacancyAsync(int slug) { if (slug.Equals(0) || slug.Equals(null)) { return(BadRequest("Slug Nulo")); } Vacancy vaga = await _services.SearchOneVacancySlugAsync(slug); if (vaga.Equals(null)) { return(Ok("Vaga inesistente")); } return(Ok(vaga)); }
public async Task <ActionResult> DeleteVacancyAsync(string id) { if (string.IsNullOrWhiteSpace(id)) { return(BadRequest("Id Nulo")); } Vacancy vaga = await _services.SearchOneVacancyIdAsync(id); if (vaga.Equals(null)) { return(NotFound("Vaga inesistente")); } await _services.DeleteOneVacancyAsync(vaga); return(Ok("Ok")); }
public async Task <ActionResult> PutVacancyAsync(string id, [FromBody] Vacancy editions) { if (string.IsNullOrWhiteSpace(id)) { return(BadRequest("Id Nulo")); } if (!ModelState.IsValid) { return(BadRequest("Modelo Invalido")); } Vacancy vaga = await _services.SearchOneVacancyIdAsync(id); if (vaga.Equals(null)) { return(NotFound("Vaga inesistente")); } await _services.ChangeOneVacancyAsync(vaga, editions); return(Ok("Ok")); }