public IHttpActionResult Post([FromBody] Titan value) { try { TitanService service = new TitanService(); service.Add(value); return(Ok(value)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult GetById(int id) { try { TitanService service = new TitanService(); var titan = service.GetById(id); if (titan != null) { return(Ok(titan)); } } catch (Exception ex) { return(InternalServerError(ex)); } return(NotFound()); }
// GET: api/Titans public IEnumerable <Titan> Get() { TitanService service = new TitanService(); return(service.GetAll()); }