예제 #1
0
        public HttpResponseMessage CreateChannel([FromBody] Channel payload)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            ItemResponse <int> response = new ItemResponse <int>();

            try
            {
                ChannelService svc = new ChannelService();
                response.Item = svc.Channel_Insert(payload);
            }
            catch (System.Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
            }
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        } //CreateChannel