Ejemplo n.º 1
0
 public ActionResult Create(LocationModel model)
 {
     var ctx = new VisitsContext();
     ctx.Locations.Add(model);
     ctx.SaveChanges();
     return View("Index", ctx.Locations);
 }
Ejemplo n.º 2
0
        public ActionResult Edit(LocationModel model)
        {
            var ctx = new VisitsContext();

            ctx.Locations.Remove(ctx.Locations.FirstOrDefault(loc => loc.LocationId == model.LocationId));
            ctx.Locations.Add(model);

            ctx.SaveChanges();

            return Edit(model.LocationId);
        }