Exemple #1
0
        //Read in CRUD
        public ActionResult Index()
        {
            var allEvents = _eventLogic.GetAllEvents();
            var _events   = new List <EventViewModel>();

            foreach (var _event in allEvents)
            {
                _events.Add(new EventViewModel
                {
                    ID          = _event.ID,
                    AccountID   = _event.AccountID,
                    CategoryID  = _event.CategoryID,
                    Date        = _event.Date,
                    Description = _event.Description,
                    Location    = _event.Location,
                    MaxCapacity = _event.MaxCapacity,
                    Name        = _event.Name
                });
            }
            return(View(_events));
        }
Exemple #2
0
        public IActionResult EventHome()
        {
            List <EventViewModel> events = new List <EventViewModel>();

            foreach (var item in logic.GetAllEvents())
            {
                EventViewModel vm = new EventViewModel(item.Id, item.Name, item.Description, item.Date, item.StartTime,
                                                       item.EndTime, item.Nrbar, item.Nrevent, item.Nriets);
                events.Add(vm);
            }

            return(View(events));
        }
Exemple #3
0
        public IActionResult GetAll()
        {
            try
            {
                IEnumerable <EventDto> events = _eventLogic.GetAllEvents();

                if (events == null)
                {
                    return(NotFound());
                }

                return(Ok(events));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal server error"));
            }
        }