public ActionResult Create(Person person) { if (ModelState.IsValid) { context.Person.Add(person); context.SaveChanges(); return RedirectToAction("Index"); } return View(person); }
// // 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; }
public ActionResult Edit(Person person) { if (ModelState.IsValid) { context.Entry(person).State = EntityState.Modified; context.SaveChanges(); return RedirectToAction("Index"); } return View(person); }