public void UT_Admin_subcategory() { var repo = new mockAdminRepository(); var service = new AdminSubCategoryV1(repo); var resp = service.Exec(null, new AuthenticatedUser(), 1); if (resp.Id != 1) { Assert.Fail("subcategory // fail 1"); } if (resp.Name != "test") { Assert.Fail("subcategory // fail 2"); } }
public ActionResult <string> SubCategory(long id) { try { using (var db = new SqlConnection(GetDBConnectionString())) { var service = new AdminSubCategoryV1(repository); var resp = service.Exec(db, GetCurrentAuthenticatedUser(), id); return(Ok(JsonConvert.SerializeObject(resp))); } } catch (System.Exception ex) { return(BadRequest(new ServiceError { DebugInfo = ex.ToString(), Message = _defaultError })); } }