public ActionResult Edit(int id)
        {
            var eventToEdit = this.LoadEvent(id);

            if (eventToEdit == null)
            {
                this.AddNotification("cannot edit event #" + id, NotificationType.ERROR);
                return(this.RedirectToAction("My"));
            }
            var model = EventInputModel.CreateFromEvent(eventToEdit);

            return(this.View(model));
        }
Exemplo n.º 2
0
        public ActionResult Delete(int id)
        {
            var eventToDelete = this.LoadEvent(id);

            if (eventToDelete == null)
            {
                this.AddNotification("Cannot delete the event #" + id, NotificationType.ERROR);
                return(this.RedirectToAction("My"));
            }
            var model = EventInputModel.CreateFromEvent(eventToDelete);

            return(View(model));
        }
        public ActionResult Delete(int id)
        {
            Event eventToDelete = LoadEvent(id);

            if (eventToDelete == null)
            {
                return(this.RedirectToAction("MyEvents"));
            }

            var model = EventInputModel.CreateFromEvent(eventToDelete);

            return(View(model));
        }
        public ActionResult Edit(int id)
        {
            Event eventToEdit = LoadEvent(id);

            if (eventToEdit == null || eventToEdit.DateAndTime < DateTime.Today)
            {
                TempData["Fail"] = "Passed event cannot be edited";
                return(RedirectToAction("MyEvents"));
            }

            var model = EventInputModel.CreateFromEvent(eventToEdit);

            return(View(model));
        }
Exemplo n.º 5
0
        public ActionResult Delete(int id)
        {
            var eventToEdit = this.LoadEvent(id);

            if (eventToEdit == null)
            {
                this.AddNotification("Cannot edit #" + id, NotificationType.ERROR);
                return(this.RedirectToAction("My"));
            }
            ViewBag.EditCreate = "Delete";

            var model = EventInputModel.CreateFromEvent(eventToEdit);

            return(View(model));
        }
        public ActionResult Delete(int id)
        {
            string currentUserId = this.User.Identity.GetUserId();
            var    isAdmin       = this.IsAdmin();
            var    eventToDelete = eventService.LoadEditEventDto(id, currentUserId, isAdmin);

            if (eventToDelete == null)
            {
                this.AddNotification("Cannot delete event #" + id, NotificationType.ERROR);
                return(this.RedirectToAction("My"));
            }

            var model = EventInputModel.CreateFromEvent(eventToDelete);

            return(this.View("Delete", model));
        }
Exemplo n.º 7
0
        public ActionResult Edit(int?Id)
        {
            if (Id == null)
            {
                this.AddNotification("Cannot edit event # " + Id, NotificationType.ERROR);
                return(RedirectToAction("My"));
            }

            Event e = LoadEvent(Id.Value);

            if (e == null)
            {
                this.AddNotification("Cannot edit event # " + Id, NotificationType.ERROR);
                return(RedirectToAction("My"));
            }

            var model = EventInputModel.CreateFromEvent(e);

            return(View(model));
        }