Ejemplo n.º 1
0
        public IHttpActionResult Put([FromBody] RoastType roastType)
        {
            IHttpActionResult result;

            if (roastType != null)
            {
                repository.Insert(roastType);
                result = StatusCode(HttpStatusCode.Created);
            }
            else
            {
                result = StatusCode(HttpStatusCode.BadRequest);
            }

            return(result);
        }
Ejemplo n.º 2
0
        public IHttpActionResult Post([FromBody] RoastType roastType)
        {
            IHttpActionResult result;

            if (roastType != null)
            {
                repository.Update(roastType);
                result = Ok();
            }
            else
            {
                result = NotFound();
            }

            return(result);
        }
Ejemplo n.º 3
0
        public IHttpActionResult Get(int id)
        {
            IHttpActionResult result;
            RoastType         roastType = repository.GetByID((int)id);

            if (roastType != null)
            {
                result = Json <RoastType>(roastType);
            }
            else
            {
                result = NotFound();
            }

            return(result);
        }