public IActionResult SelectAll() { CarteraDTO query = new CarteraDTO(); PaqueteDTO pack = new PaqueteDTO(); List <CarteraModel> lista = query.SelectAll(); if (lista != null) { pack.status = 200; pack.msn = "Success"; pack.data = lista.ToArray(); return(Ok(pack)); } else { pack.status = 400; pack.msn = "No se encontraron registros"; return(Ok(pack)); } }
public IActionResult Delete(int id) { CarteraDTO query = new CarteraDTO(); PaqueteDTO pack = new PaqueteDTO(); CarteraModel cartera = query.Delete(id); if (cartera != null) { List <CarteraModel> data = new List <CarteraModel>(); data.Add(cartera); pack.status = 200; pack.msn = "Success"; pack.data = data.ToArray(); return(Ok(pack)); } else { return(BadRequest(pack)); } }
public IActionResult SelectByForeingKey(int ForeingKey) { CarteraDTO query = new CarteraDTO(); PaqueteDTO pack = new PaqueteDTO(); CarteraModel c = query.SelectByIdForeig(ForeingKey); if (c != null) { List <CarteraModel> data = new List <CarteraModel>(); data.Add(c); pack.status = 200; pack.msn = "Success"; pack.data = data.ToArray(); return(Ok(pack)); } else { pack.status = 400; pack.msn = "No se encontraron resultados"; return(BadRequest(pack)); } }
public IActionResult Update(CarteraModel c) { PaqueteDTO pack = new PaqueteDTO(); CarteraDTO query = new CarteraDTO(); CarteraModel upgrade = query.Update(c); if (upgrade != null) { List <CarteraModel> data = new List <CarteraModel>(); data.Add(upgrade); pack.status = 200; pack.msn = "Success"; pack.data = data.ToArray(); return(Ok(pack)); } else { pack.status = 400; pack.msn = "Error al insertar los datos"; return(BadRequest(pack)); } }
public IActionResult Create(CarteraModel c) { CarteraDTO query = new CarteraDTO(); PaqueteDTO pack = new PaqueteDTO(); CarteraModel insert = query.Insert(c); if (insert != null) { List <CarteraModel> data = new List <CarteraModel>(); data.Add(insert); pack.status = 200; pack.msn = "Success"; pack.data = data.ToArray(); return(Ok(pack)); } else { pack.status = 400; pack.msn = "No se encontraron resultados"; return(BadRequest(pack)); } }