示例#1
0
        public ActionResult Create(Person person)
        {
            if (ModelState.IsValid)
            {
                context.Person.Add(person);
                context.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(person);
        }
示例#2
0
        //
        // GET: /Person/Create
        public string Create(string Ime, string Long, string Lat)
        {
            Person person = new Person(Ime, double.Parse(Long),double.Parse(Lat));
            try
            {
                Person personRemove = context.Person.Single(x => x.Ime == Ime);
                context.Person.Remove(personRemove);
                context.SaveChanges();
            }
            catch { }

            context.Person.Add(person);
            context.SaveChanges();
            return Ime;
        }
示例#3
0
 public ActionResult Edit(Person person)
 {
     if (ModelState.IsValid)
     {
         context.Entry(person).State = EntityState.Modified;
         context.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(person);
 }