예제 #1
0
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";
            using (var context = new JoinINN.Infrastructure.GroupsDb())
            {
                context.Visitors.First().NumberOfVisits++;
                context.SaveChanges();
            }

            return View();
        }
예제 #2
0
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";
            using (var context = new JoinINN.Infrastructure.GroupsDb())
            {
                context.Visitors.First().NumberOfVisits++;
                context.SaveChanges();
            }

            return(View());
        }
예제 #3
0
 public bool AdminDeleteUser(int id)
 {
     using (var context = new JoinINN.Infrastructure.GroupsDb())
     {
         try
         {
             var groupToDelete = context.SocialGroups.FirstOrDefault(x => x.Id == id);
             context.SocialGroups.Remove(groupToDelete);
             context.SaveChanges();
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
예제 #4
0
 public bool AdminDeleteUser(int id)
 {
     using (var context = new JoinINN.Infrastructure.GroupsDb())
     {
         try
         {
             var groupToDelete = context.SocialGroups.FirstOrDefault(x => x.Id == id);
             context.SocialGroups.Remove(groupToDelete);
             context.SaveChanges();
             return true;
         }
         catch (Exception e)
         {
             return false;
         }
     }
 }
 public bool AddNewGroup(SocialGroup socGroup)
 {
     using (var context = new JoinINN.Infrastructure.GroupsDb())
     {
         try
         {
             socGroup.AffinityType = context.AffinityTypes.FirstOrDefault(x => x.Id == socGroup.AffinityType_Id);
             socGroup.City = context.Cities.FirstOrDefault(x => x.Id == socGroup.CityId);
             context.SocialGroups.Add(socGroup);
             context.SaveChanges();
             return true;
         }
         catch (DbEntityValidationException dbEx)
         {
             return false;
         }
     }
 }
예제 #6
0
 public bool AddNewGroup(SocialGroup socGroup)
 {
     using (var context = new JoinINN.Infrastructure.GroupsDb())
     {
         try
         {
             socGroup.AffinityType = context.AffinityTypes.FirstOrDefault(x => x.Id == socGroup.AffinityType_Id);
             socGroup.City         = context.Cities.FirstOrDefault(x => x.Id == socGroup.CityId);
             context.SocialGroups.Add(socGroup);
             context.SaveChanges();
             return(true);
         }
         catch (DbEntityValidationException dbEx)
         {
             return(false);
         }
     }
 }
        public void EditUser(SocialGroup socGroup)
        {
            using (var context = new JoinINN.Infrastructure.GroupsDb())
            {
                try
                {
                    var existingSocGroup = context.SocialGroups.FirstOrDefault(x => x.Id == socGroup.Id);

                    existingSocGroup.AffinityType = context.AffinityTypes.FirstOrDefault(x => x.Id == socGroup.AffinityType_Id);
                    existingSocGroup.Password = socGroup.Password;
                    existingSocGroup.Name = socGroup.Name;
                    existingSocGroup.OfficialWebUrl = socGroup.OfficialWebUrl;
                    existingSocGroup.FacebookPageUrl = socGroup.FacebookPageUrl;
                    existingSocGroup.photoUrl = socGroup.photoUrl;
                    existingSocGroup.ContactNumber = socGroup.ContactNumber;
                    existingSocGroup.Description = socGroup.Description;

                    context.SaveChanges();
                }
                catch (DbEntityValidationException dbEx)
                {
                }
            }
        }
예제 #8
0
        public void EditUser(SocialGroup socGroup)
        {
            using (var context = new JoinINN.Infrastructure.GroupsDb())
            {
                try
                {
                    var existingSocGroup = context.SocialGroups.FirstOrDefault(x => x.Id == socGroup.Id);

                    existingSocGroup.AffinityType    = context.AffinityTypes.FirstOrDefault(x => x.Id == socGroup.AffinityType_Id);
                    existingSocGroup.Password        = socGroup.Password;
                    existingSocGroup.Name            = socGroup.Name;
                    existingSocGroup.OfficialWebUrl  = socGroup.OfficialWebUrl;
                    existingSocGroup.FacebookPageUrl = socGroup.FacebookPageUrl;
                    existingSocGroup.photoUrl        = socGroup.photoUrl;
                    existingSocGroup.ContactNumber   = socGroup.ContactNumber;
                    existingSocGroup.Description     = socGroup.Description;

                    context.SaveChanges();
                }
                catch (DbEntityValidationException dbEx)
                {
                }
            }
        }