Esempio n. 1
0
        public IHttpActionResult Post([FromBody] Titan value)
        {
            try
            {
                TitanService service = new TitanService();
                service.Add(value);

                return(Ok(value));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
        // GET: api/Titans
        public IEnumerable <Titan> Get()
        {
            TitanService service = new TitanService();

            return(service.GetAll());
        }