Exemplo n.º 1
0
        public void UT_Admin_products()
        {
            var repo    = new mockAdminRepository();
            var service = new AdminProductsV1(repo);

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

            if (resp.list.Count != 1)
            {
                Assert.Fail("products // fail 1");
            }
        }
Exemplo n.º 2
0
        public ActionResult <string> Products(long categID, long subcategID, int skip, int take)
        {
            try
            {
                using (var db = new SqlConnection(GetDBConnectionString()))
                {
                    var service = new AdminProductsV1(repository);
                    var resp    = service.Exec(db, categID, subcategID, skip, take);

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