Exemplo n.º 1
0
        public Event_AttendingStatus EventGoingInsert(int Userid, Event_AttendingStatus obj)
        {
            using (var context = _dbContextFactory.CreateConnection())
            {
                if (obj.UserGoingStatus == "Maybe")
                {
                    var Count = context.Event_AttendingStatus.Where(x => x.Status == true && x.UserGoingStatus == obj.UserGoingStatus && x.EventId == obj.EventId && x.UserId == obj.UserId).Count();
                    if (Count == 0)
                    {
                        context.Event_AttendingStatus.Add(obj);
                        context.SaveChanges();
                    }
                    var DeclineCount = context.Event_AttendingStatus.Where(x => x.Status == true && x.UserGoingStatus == "Decline" && x.EventId == obj.EventId && x.UserId == obj.UserId).Count();
                    if (DeclineCount >= 1)
                    {
                        Event_AttendingStatus atteningstaus = context.Event_AttendingStatus.Where(x => x.Status == true && x.EventId == obj.EventId && x.UserGoingStatus == "Decline" && x.UserId == obj.UserId).FirstOrDefault();
                        context.Event_AttendingStatus.Remove(atteningstaus);
                        context.SaveChanges();
                    }
                }
                else if (obj.UserGoingStatus == "Decline")
                {
                    var DeclineCount = context.Event_AttendingStatus.Where(x => x.Status == true && x.UserGoingStatus == "Maybe" && x.EventId == obj.EventId && x.UserId == obj.UserId).Count();
                    var Maybedecline = context.Event_AttendingStatus.Where(x => x.Status == true && x.UserGoingStatus == "Decline" && x.EventId == obj.EventId && x.UserId == obj.UserId).Count();

                    if (Maybedecline >= 1)
                    {
                    }
                    else
                    {
                        context.Event_AttendingStatus.Add(obj);
                        context.SaveChanges();
                    }

                    if (DeclineCount >= 1)
                    {
                        Event_AttendingStatus attendingstaus = context.Event_AttendingStatus.Where(x => x.Status == true && x.EventId == obj.EventId && x.UserGoingStatus == "Maybe" && x.UserId == obj.UserId).FirstOrDefault();
                        context.Event_AttendingStatus.Remove(attendingstaus);
                        context.SaveChanges();
                    }
                }
                else if (obj.UserGoingStatus == "AmGoing")
                {
                    var DeclineCount = context.Event_AttendingStatus.Where(x => x.Status == true && x.UserGoingStatus == "Maybe" && x.EventId == obj.EventId && x.UserId == obj.UserId).Count();
                    var AmGoing      = context.Event_AttendingStatus.Where(x => x.Status == true && x.UserGoingStatus == "AmGoing" && x.EventId == obj.EventId && x.UserId == obj.UserId).Count();
                    var Maybedecline = context.Event_AttendingStatus.Where(x => x.Status == true && x.UserGoingStatus == "Decline" && x.EventId == obj.EventId && x.UserId == obj.UserId).Count();

                    if (AmGoing >= 1)
                    {
                    }
                    else
                    {
                        context.Event_AttendingStatus.Add(obj);
                        context.SaveChanges();
                    }
                }
            }
            return(obj);
        }
Exemplo n.º 2
0
        public JsonResult EventGoing(int Type, string Status, int EventId)
        {
            Event_AttendingStatus Attending = new Event_AttendingStatus()
            {
                UserId = Convert.ToInt64(Session["UserId"].ToString()),
                UserGoingStatus = Status,
                Status = true,
                CreatedOn = DateTime.Now,
                EventId = EventId

            };
            EventService.EventGoingInsert(Convert.ToInt32(Session["UserId"].ToString()), Attending);
            var data = EventService.EventGoingList(EventId, Convert.ToInt32(Session["UserId"]));

            return Json(data, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 3
0
        public JsonResult EventGoing(int Type, string Status, int EventId)
        {
            Event_AttendingStatus Attending = new Event_AttendingStatus()
            {
                UserId          = Convert.ToInt64(Session["UserId"].ToString()),
                UserGoingStatus = Status,
                Status          = true,
                CreatedOn       = DateTime.Now,
                EventId         = EventId
            };

            EventService.EventGoingInsert(Convert.ToInt32(Session["UserId"].ToString()), Attending);
            var data = EventService.EventGoingList(EventId, Convert.ToInt32(Session["UserId"]));


            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
 public Event_AttendingStatus EventGoingInsert(int Userid, Event_AttendingStatus obj)
 {
     return(_IEventCategoryRepo.EventGoingInsert(Userid, obj));
 }