public ActionResult RunCreateGroup(moments obj) { int counter; string MomentName = Request.Form["MomentName"].ToString(); string MomentDescription = Request.Form["MomentDescription"].ToString(); string getthemaxnumber = Request.Form["Momentmaxnumber"].ToString(); Session["getthemaxnumber"] = getthemaxnumber; var authToken = new byte[16]; byte[] Momentimage = authToken; userMomentDal usrmomentsdal = new userMomentDal(); momentsDal moments = new momentsDal(); List <moments> momentsID = (from tmp in moments.momentsLst select tmp).ToList <moments>(); if (momentsID.Count == 0) { counter = 1; } else { counter = moments.momentsLst.Max(x => x.mid) + 1; } moments added_moment = new moments(); added_moment.mid = 1; added_moment.mImage = Momentimage; added_moment.mName = MomentName; added_moment.mDescription = MomentDescription; moments.momentsLst.Add(added_moment); moments.SaveChanges(); users u = GetUser(); userMoments usermoment = new userMoments(); usermoment.username = u.username; Session["mid"] = counter; usermoment.mid = counter; usermoment.GroupName = MomentName; Session["MomentName1"] = MomentName; Session["getmidd"] = usermoment.mid; usermoment.uType = "Admin"; umd.userMomentLST.Add(usermoment); umd.SaveChanges(); return(View("AddMembersToGroup")); }
public moments getcorrentrungroup() { moments getcorrgroup = new moments(); return(getcorrgroup); }