public async Task <ActionResult> Put([FromBody] VagaDtoUpdate campanha)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var result = await _service.Put(campanha);

                if (result != null)
                {
                    return(Ok(result));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (ArgumentException e)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message));
            }
        }
示例#2
0
        public async Task <VagaEntity> Put(VagaDtoUpdate vaga)
        {
            var entity = _mapper.Map <VagaEntity>(vaga);

            return(await _repository.UpdateAsync(entity));
        }