public ActionResult DeleteConfirmed(int id) { ListaDeContactos listaDeContactos = db.Tcontactos.Find(id); db.Tcontactos.Remove(listaDeContactos); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Cliente,Telefone,Email")] ListaDeContactos listaDeContactos) { if (ModelState.IsValid) { db.Entry(listaDeContactos).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(listaDeContactos)); }
public ActionResult Create([Bind(Include = "ID,Cliente,Telefone,Email")] ListaDeContactos listaDeContactos) { if (ModelState.IsValid) { db.Tcontactos.Add(listaDeContactos); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(listaDeContactos)); }
// GET: ListaDeContactos/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ListaDeContactos listaDeContactos = db.Tcontactos.Find(id); if (listaDeContactos == null) { return(HttpNotFound()); } return(View(listaDeContactos)); }
private ListaDeContactos obtenerContactos() { List <Contacto> contactos = new List <Contacto>(); ListaDeContactos nuevo = new ListaDeContactos(contactos); nuevo.foto = "~/Images/pato.jpg"; try { int cifradoValue = Int16.Parse(HttpContext.Request.Cookies["cifrado"].Value); using (var client = new HttpClient()) { string adress = "/api/users/"; client.BaseAddress = new Uri("https://localhost:44316/api/users"); var responseTask = client.GetAsync(adress); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readJob = result.Content.ReadAsAsync <IList <Usuario> >(); readJob.Wait(); var lista = readJob.Result; foreach (var item in lista) { nuevo.Contactos.Add(new Contacto(item.username, "")); } return(nuevo); } else { return(nuevo); } } } catch (Exception e) { return(nuevo); } }