Ejemplo n.º 1
0
        public HttpResponseMessage Get(string title)
        {
            SanitizerHelper.Paranoide(title);
            var result = _itemService.GetItemByName(title);

            if (result != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, new { Message = "Not found" }));
            }
        }
Ejemplo n.º 2
0
        public HttpResponseMessage Add(Item item)
        {
            SanitizerHelper.Paranoide(item);
            var result = _itemService.Create(item);

            if (result.ExecutedSuccesfully)
            {
                return(Request.CreateResponse(HttpStatusCode.Created, item));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, new { Message = result.Message }));
            }
        }