public IActionResult GetStatusFalse() { try { using (Models.TestFidelityToolsContext db = new Models.TestFidelityToolsContext()) { var lista = (from a in db.Productos where a.Estado == false select a).ToList(); if (lista.Count != 0) { return(Ok(lista)); } else { return(NotFound()); } } } catch { return(BadRequest()); } }
public IActionResult GetId(string nombre) { try { using (Models.TestFidelityToolsContext db = new Models.TestFidelityToolsContext()) { var lista = (from a in db.TiposProductos where a.Nombre == nombre select a).ToList(); if (lista.Count != 0) { return(Ok(lista)); } else { return(NotFound()); } } } catch { return(BadRequest()); } }
public IActionResult GetDescription(int id) { try { using (Models.TestFidelityToolsContext db = new Models.TestFidelityToolsContext()) { var lista = (from a in db.TiposProductos where a.Id == id select a).ToList(); if (lista.Count != 0) { return(Ok(lista)); } else { return(NotFound()); } } } catch { return(BadRequest()); } }
public ActionResult Get() { using (Models.TestFidelityToolsContext db = new Models.TestFidelityToolsContext()) { var lista = (from a in db.Productos select a).ToList(); return(Ok(lista)); } //return new string[] { "value1", "value2" }; }
public IActionResult Get(int id) { try { using (Models.TestFidelityToolsContext db = new Models.TestFidelityToolsContext()) { Productos product = db.Productos.Find(id); if (product != null) { return(Ok(product)); } else { return(NotFound()); } } } catch { return(BadRequest()); } }