コード例 #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;
         }
     }
 }
コード例 #5
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;
         }
     }
 }
コード例 #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);
         }
     }
 }
コード例 #7
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)
                {
                }
            }
        }
コード例 #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)
                {
                }
            }
        }