Esempio n. 1
0
        public ActionResult Editor(string NAme, string LastNAme)
        {
            KontaktyDatabase db = new KontaktyDatabase();
            var dane            = db.Contacts;

            return(View(dane));
        }
Esempio n. 2
0
        public JsonResult Add(string name, string lastName)
        {
            KontaktyDatabase db = new KontaktyDatabase();
            var dane            = db.Contacts;

            return(Json(dane));
        }
Esempio n. 3
0
        public JsonResult Index()
        {
            KontaktyDatabase db = new KontaktyDatabase();
            var items           = db.Contacts;
            var list            = items.ToList();

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
        public JsonResult ShowContacts(string name, string lastName)
        {
            KontaktyDatabase db = new KontaktyDatabase();
            var items           = db.Contacts;
            var list            = items.ToList();

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
        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"));
        }
Esempio n. 7
0
        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));
        }
Esempio n. 8
0
        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"));
        }