public async Task <List <Product> > GetAll([FromHeader] string auth) { string user; if ((user = JwtBuilder.UserJwtToken(auth).Result) == null || !UserStore.Exists(user).Result) { HttpContext.Response.StatusCode = (int)HttpStatusCode.Unauthorized; return(null); } HttpContext.Response.Headers.Add("auth", auth); return(await ProductStore.GetAll()); }
public IActionResult Get(string name) { if (name == null) { return(Ok(_mProductStore.GetAll())); } if (string.IsNullOrWhiteSpace(name)) { return(NotFound(name)); } var result = _mProductStore.GetByName(name); if (result == null) { return(NotFound(name)); } return(Ok(result)); }
public IEnumerable <Product> Get(string name) { Console.WriteLine(name); return(name == null?_store.GetAll() : _store.GetByName(name)); }
public async Task ProductsReturnAllProductsAsync() { var products = await productsController.Products(); products.Should().BeEquivalentTo(productStore.GetAll()); }
public IEnumerable <Product> Get(string name) { return(name == null?_mProductStore.GetAll() : _mProductStore.GetByName(name)); }