Beispiel #1
0
        public IActionResult Display(int activityId)
        {
            int?UserId = HttpContext.Session.GetInt32("UserId");

            if (UserId == null)
            {
                return(Redirect("/"));
            }
            else
            {
                User      User      = context.UserList.FirstOrDefault(x => x.UserId == HttpContext.Session.GetInt32("UserId"));
                DojoEvent dojoEvent = context.ActivityList.Include(x => x.Coordinator).Include(y => y.Attendees).ThenInclude(z => z.AUser).FirstOrDefault(w => w.DojoEventId == activityId);
                ViewBag.DojoEvent = dojoEvent;
                ViewBag.User      = User;

                List <Participate> userAttending = context.Join.Where(a => a.UserId == User.UserId).Include(d => d.DojoEvent).ToList();
                List <int>         attendingIds  = new List <int>();
                foreach (Participate d in userAttending)
                {
                    attendingIds.Add(d.DojoEventId);
                }
                ViewBag.UserAttending = attendingIds;
                return(View());
            }
        }
Beispiel #2
0
        public IActionResult Delete(int activityId)
        {
            DojoEvent Event = context.ActivityList.FirstOrDefault(x => x.DojoEventId == activityId);

            context.ActivityList.Remove(Event);
            context.SaveChanges();
            return(RedirectToAction("Home"));
        }
Beispiel #3
0
        public void showEvent(DojoEvent dojoEvent)
        {
            TitleEvent.Text = dojoEvent.Title;
            Run run = new Run
            {
                Text = dojoEvent.Description
            };

            DescriptionEvent.Inlines.Add(run);

            /*
             * DateTImeDetail.Text = dojoEvent.StartTime.ToString();
             * LogoDetail.Source = new BitmapImage(new Uri(dojoEvent.Logo));
             */

            LoadMap(dojoEvent.Location);
        }
Beispiel #4
0
 public IActionResult GenerateActivity(DojoEvent newEvent)
 {
     if (ModelState.IsValid)
     {
         Participate newJoin = new Participate();
         newEvent.UserID = (int)HttpContext.Session.GetInt32("UserId");
         context.ActivityList.Add(newEvent);
         context.SaveChanges();
         newJoin.DojoEventId = newEvent.DojoEventId;
         newJoin.UserId      = newEvent.UserID;
         context.Join.Add(newJoin);
         context.SaveChanges();
         return(Redirect($"{newEvent.DojoEventId}"));
     }
     else
     {
         return(View("Create"));
     }
 }