public HttpResponseMessage PostCanal([FromBody] NOT_CANAL data)
        {
            if (data == null)
            {
                return new HttpResponseMessage {
                           StatusCode = HttpStatusCode.BadRequest, ReasonPhrase = "POST body is null"
                }
            }
            ;

            try
            {
                NOT_CANAL rs = canal.Create(data);

                return(new HttpResponseMessage {
                    StatusCode = HttpStatusCode.OK, ReasonPhrase = "Saved"
                });
            }
            catch (Exception ex)
            {
                return(new HttpResponseMessage {
                    StatusCode = HttpStatusCode.InternalServerError, ReasonPhrase = $"Document could not be created: {ex.InnerException}"
                });
            }
            finally
            {
                //session.Dispose();
            }
        }
        public IEnumerable <NOT_CANAL> GetCanalById(String id)
        {
            NOT_CANAL listaCanal = new NOT_CANAL();

            try
            {
                listaCanal = canal.Read(id);
            }
            catch (Exception e)
            {
                //HttpResponseMessage { StatusCode = HttpStatusCode.OK, ReasonPhrase = "Deleted" };
            }
            finally
            {
                //session.Dispose();
            }

            yield return(listaCanal);
        }
        public HttpResponseMessage PutCanal(string id, [FromBody]  NOT_CANAL data)
        {
            if (String.IsNullOrEmpty(id))
            {
                return new HttpResponseMessage {
                           StatusCode = HttpStatusCode.BadRequest, ReasonPhrase = "Identifier could not be empty"
                }
            }
            ;

            if (data == null)
            {
                return new HttpResponseMessage {
                           StatusCode = HttpStatusCode.BadRequest, ReasonPhrase = "PUT body is null"
                }
            }
            ;

            try
            {
                canal.Update(id, data);

                return(new HttpResponseMessage {
                    StatusCode = HttpStatusCode.OK, ReasonPhrase = "Updated"
                });
            }
            catch (Exception ex)
            {
                return(new HttpResponseMessage {
                    StatusCode = HttpStatusCode.InternalServerError, ReasonPhrase = $"Document could not be updated: {ex.InnerException}"
                });
            }
            finally
            {
                //session.Dispose();
            }
        }