// A utility function that facilitates the call to the helper to retrieve an Invoice from the database.
        private InvoiceDto getInvoiceDto(int invoiceId)
        {
            HttpResponseMessage response = helper.doGetRequest(getUrl("Get", invoiceId));

            if (!response.IsSuccessStatusCode)
            {
                return(null);
            }
            return(helper.getFromResponse <InvoiceDto>(response));
        }
コード例 #2
0
        /// <summary>
        /// Get and display a list of all the Products in the database.
        /// </summary>
        /// <returns>A View containing a List of ProductDto objects.</returns>
        /// <example>
        /// GET: Products
        /// </example>
        public ActionResult Index()
        {
            HttpResponseMessage response = helper.doGetRequest(getUrl("Get") + "s");

            if (!response.IsSuccessStatusCode)
            {
                return(View());
            }

            return(View(helper.getFromResponse <IEnumerable <ProductDto> >(response)));
        }