Exemplo n.º 1
0
        public ActionResult Create(VenueViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var venueCrear = new Venue(viewModel, db);
                new Repositorio <Venue>(db).Crear(venueCrear);

                return(RedirectToAction("Index"));
            }

            viewModel.RegenerarVista(db);

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public ActionResult Edit(VenueViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                Venue venue = new Repositorio <Venue>(db).Traer(viewModel.Id);

                venue.Modificar(viewModel, db);
                new Repositorio <Venue>(db).Modificar(venue);

                return(RedirectToAction("Index"));
            }

            viewModel.RegenerarVista(db);

            return(View(viewModel));
        }
Exemplo n.º 3
0
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Venue venueModificar = new Repositorio <Venue>(db).Traer(id.Value);

            if (venueModificar == null)
            {
                return(HttpNotFound());
            }

            var venueViewModel = new VenueViewModel(venueModificar, db);

            venueViewModel.RegenerarVista(db);

            return(View(venueViewModel));
        }