public ActionResult Editor(string NAme, string LastNAme) { KontaktyDatabase db = new KontaktyDatabase(); var dane = db.Contacts; return(View(dane)); }
public JsonResult Add(string name, string lastName) { KontaktyDatabase db = new KontaktyDatabase(); var dane = db.Contacts; return(Json(dane)); }
public JsonResult Index() { KontaktyDatabase db = new KontaktyDatabase(); var items = db.Contacts; var list = items.ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
public JsonResult ShowContacts(string name, string lastName) { KontaktyDatabase db = new KontaktyDatabase(); var items = db.Contacts; var list = items.ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
public void Delete(int id) { KontaktyDatabase db = new KontaktyDatabase(); //int Id = Int32.Parse(id); Contact contactFind = db.Contacts.Find(id); db.Contacts.Remove(contactFind); db.SaveChanges(); }
public ActionResult Dalete(Contact contactDelete, string id) { KontaktyDatabase db = new KontaktyDatabase(); int Id = Int32.Parse(id); Contact contactFind = db.Contacts.Find(Id); db.Contacts.Remove(contactFind); db.SaveChanges(); return(RedirectToAction("Index")); }
public JsonResult Add(Contact newContact, string name, string lastName) { var contact = (string.Format("name:{0}, lastName:{1}", name, lastName)); KontaktyDatabase db = new KontaktyDatabase(); db.Contacts.Add(newContact); db.SaveChanges(); return(Json(contact)); }
public ActionResult Editor(Contact newContact, string NAme, string LastNAme) { var contact = (string.Format("NAme:{0}, LastNAme:{1}", NAme, LastNAme)); ViewBag.Message = "Add your name"; KontaktyDatabase db = new KontaktyDatabase(); db.Contacts.Add(newContact); db.SaveChanges(); return(RedirectToAction("Index")); }