public ActionResult _MakePost(PostLocationModel plm) { User u = ur.GetUser(); if (ModelState.IsValid) { plm.Tpost.UserID = u.UserId; //Location loc = new Location(); // loc.LocationName = plm.Tlocation.LocationName; // loc.Longitude = plm.Tlocation.Longitude; // loc.Latitude = plm.Tlocation.Latitude; db.Locations.Add(plm.Tlocation); db.SaveChanges(); int newPK = plm.Tlocation.LocationID; plm.Tpost.LocationID = newPK; plm.Tpost.CreationDate = System.DateTime.Now; db.Posts.Add(plm.Tpost); db.SaveChanges(); var glist = gr.NotPrivateOrOwner(u); ViewBag.TestingGroupList = glist; ViewBag.GroupList = new SelectList(glist, "GroupID", "GroupName"); //Close the post window, remove the circle selector, and add the new post // to the map. string closepostjs = "$('#postcontainer').hide(); removeRadiusSelctor();" + "updateMarkers();"; return(JavaScript(closepostjs)); } // take groups which are not private unioned with private groups to which the user is an owner var glist1 = gr.NotPrivateOrOwner(u); ViewBag.TestingGroupList = glist1; ViewBag.GroupList = new SelectList(glist1, "GroupID", "GroupName"); return(PartialView("_MakePost")); }
public void MakePublic(int GroupId) { try { Group g = db.Groups.First(d => d.GroupID == GroupId); g.IsPrivate = false; db.SaveChanges(); } catch { return; } }
public void Save() { db.SaveChanges(); }