Ejemplo n.º 1
0
        public ActionResult <ErrorDTO> Put([FromBody] ErrorEntryDTO entry)
        {
            if (entry.Id.HasValue && _service.CheckError(entry.Id.Value))
            {
                _service.Update(_mapper.Map <Error>(entry));
                return(Ok());
            }


            return(BadRequest("Error not found"));
        }
Ejemplo n.º 2
0
 public ActionResult <ErrorEntryDTO> Post([FromBody] ErrorEntryDTO entry)
 {
     try
     {
         var newEntry = _service.Register(_mapper.Map <Error>(entry));
         return(Ok(_mapper.Map <ErrorDTO>(newEntry)));
     }
     catch (Exception exc)
     {
         return(BadRequest(exc.Message));
     }
 }