public ActionResult Index() { ViewBag.Title = "Home Page"; using (var context = new JoinINN.Infrastructure.GroupsDb()) { context.Visitors.First().NumberOfVisits++; context.SaveChanges(); } return View(); }
public ActionResult Index() { ViewBag.Title = "Home Page"; using (var context = new JoinINN.Infrastructure.GroupsDb()) { context.Visitors.First().NumberOfVisits++; context.SaveChanges(); } return(View()); }
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 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; } } }
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) { } } }