Beispiel #1
0
        public ActionResult <Item> Post(Item item)
        {
            Item items = null;

            try
            {
                items = _service.AddItem(item);
            }
            catch (ArgumentException ex)
            {
                return(StatusCode((int)HttpStatusCode.BadRequest, new { ErrorCode = 1, Message = ex.Message }));
            }
            catch (Exception ex)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, new { ErrorCode = 500, Message = ex.Message }));
            }

            return(items);
        }