Пример #1
0
        public void UT_Portal_products()
        {
            var repo    = new mockPortalRepository();
            var service = new PortalProductsV1(repo);

            var resp = service.Exec(null, 1, 1, 0, 10);

            if (resp.list.Count != 1)
            {
                Assert.Fail("products // fail 1");
            }
        }
Пример #2
0
        public ActionResult <string> PortalProducts(long categID, long subcategID, int skip, int take)
        {
            try
            {
                using (var db = new SqlConnection(GetDBConnectionString()))
                {
                    var service = new PortalProductsV1(portalRepository);
                    var resp    = service.Exec(db, categID, subcategID, skip, take);

                    var strResp = JsonConvert.SerializeObject(resp);

                    return(Ok(strResp));
                }
            }
            catch (System.Exception ex)
            {
                return(BadRequest(new ServiceError {
                    DebugInfo = ex.ToString(), Message = _defaultError
                }));
            }
        }