Пример #1
0
        public async Task <IActionResult> Put(Matricula Request)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(Request));
                }
                var matricula = await _repo.GetMatriculaById(Request.Id);

                if (matricula == null)
                {
                    return(NotFound(MSG.NaoExisteMatricula));
                }
                _repo.Update(Request);
                if (await _repo.SaveChangesAsync())
                {
                    return(Created($"/api/[controler]/Matricula{Request.Tipo}", Request));
                }
                return(BadRequest());
            }
            catch (Exception)
            {
                return(this.StatusCode(StatusCodes.Status501NotImplemented, MSG.BancoDadosFalhou));
            }
        }
 public IActionResult Put(Matricula model)
 {
     _matriculaRepository.Update(model);
     return(Ok());
 }