예제 #1
0
        public IActionResult ModificaAula(string nomeaula, [FromBody] JsonPatchDocument <AulaModel> patchDoc)
        {
            if (patchDoc == null)
            {
                return(BadRequest());
            }
            Aula aula = repository.GetAulaById(nomeaula);

            if (aula == null)
            {
                return(BadRequest());
            }
            AulaModel model = new AulaModel(aula);

            patchDoc.ApplyTo(model);
            try
            {
                repository.UpdateAula(model.GetAula());
                return(Ok(model));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }