public ActionResult Index() { string username = Convert.ToString(Request["userName"]); string fbId = Convert.ToString(Request["fbId"]); string packName; packId= Convert.ToInt32(Request["packid"]); ViewBag.packID = packId; DateTime now = DateTime.Now; ViewBag.name = username; ViewBag.id = fbId; if (Request["packName"] == "") { packName = DateTime.Now.ToString(); } else { packName = Convert.ToString(Request["packName"]); } if (username.IsNullOrWhiteSpace()) { ViewBag.Title = username + "Profile"; } else { ViewBag.Title = username + " | Profile"; } ViewBag.username = username; ViewBag.fbID = fbId; string email = Convert.ToString(Request["fbEmail"]); //Response.Write(email+"</br>"); string[] pids = Request.QueryString.GetValues("pid"); string[] photos = Request.QueryString.GetValues("photoid"); //Response.Write(username + "</br>" + fbId + "</br>"+pids[0]); using (var context = new TourCrowDBEntities()) { //var query = from usr in tcdb.USERs where usr.UserFBID == fbId select usr; //var chkusr = query.Count(); //Response.Write(chkusr); try { var query = from usr in context.USERs where usr.UserFBID == fbId select usr; var chkusr = query.Count(); if (chkusr > 0 && pids.Length > 0) { insertPackage(pids, fbId, username, photos, packName, now); } else if (chkusr <= 0 && pids.Length > 0) { var user_insert_query = new USER { UserName = username, UserFBID = fbId }; context.USERs.Add(user_insert_query); context.SaveChanges(); insertPackage(pids, fbId, username, photos, packName, now); } } catch (Exception) { //Response.Write("No Place Selected"); } } showPackages(fbId); getPackageInfo(fbId,packId); return View(); }
public ActionResult Index() { ViewBag.Title = "Plan"; ViewBag.activePage = "Plan"; string username = Convert.ToString(Request["userName"]); string fbId = Convert.ToString(Request["fbId"]); string packName; packId = Convert.ToInt32(Request["packid"]); ViewBag.packID = packId; DateTime now = DateTime.Now; ViewBag.name = username; ViewBag.id = fbId; search_val = Convert.ToString(Request["search"]) == null ? "null" : Convert.ToString(Request["search"]); ViewBag.pageGetValue = search_val; string email = Convert.ToString(Request["fbEmail"]); //Response.Write(email+"</br>"); string[] pids = Request.QueryString.GetValues("pid"); string[] photos = Request.QueryString.GetValues("photoid"); if (Request["packName"] == "") { packName = DateTime.Now.ToString(); } else { packName = Convert.ToString(Request["packName"]); } using (var context = new TourCrowDBEntities()) { //var query = from usr in tcdb.USERs where usr.UserFBID == fbId select usr; //var chkusr = query.Count(); //Response.Write(chkusr); try { var query = from usr in context.USERs where usr.UserFBID == fbId select usr; var chkusr = query.Count(); if (chkusr > 0 && pids.Length > 0) { insertPackage(pids, fbId, username, photos, packName, now); } else if (chkusr <= 0 && pids.Length > 0) { var user_insert_query = new USER { UserName = username, UserFBID = fbId }; context.USERs.Add(user_insert_query); context.SaveChanges(); insertPackage(pids, fbId, username, photos, packName, now); } } catch (Exception) { //Response.Write("No Place Selected"); } } return View(); }