public ActionResult DeleteConfirmed2(int id) { ad ad = db.ads.Find(id); var adb = db.reports.Where(u => u.adId == id); foreach (var a in adb) { db.reports.Remove(a); } var c = db.views.Where(u => u.ad_id == id); foreach (var d in c) { db.views.Remove(d); } db.ads.Remove(ad); db.SaveChanges(); return(Redirect("/Regester/report")); }
public ad AddPost(ad _ad) { var maxId = 1; if (db.ad.Any()) { maxId = db.ad.Max(a => a.ad_id) + 1; } var newPost = new ad { ad_id = maxId, title = _ad.title, category_id = _ad.category_id, description = _ad.description, date_added = DateTime.Now, price = _ad.price, user_id = _ad.user_id, image_url = _ad.image_url, city = _ad.city, province_id = _ad.province_id }; db.ad.Add(newPost); db.SaveChanges(); return(newPost); }
public ActionResult viewad(int id, string username) { ad ad = user.getad(id, username); ViewBag.username = ad.user; return(View(ad)); }
public ActionResult DeleteConfirmed1(int id) { ad ad = db.ads.Find(id); db.ads.Remove(ad); db.SaveChanges(); return(Redirect("/Regester/Admin")); }
public async Task <ActionResult> DeleteConfirmed(int id) { ad ad = await db.Ads.FindAsync(id); db.Ads.Remove(ad); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
////////////////////////////////////////////////////////////Report Delete////////////////////////////// public ActionResult Delete2(int id = 0) { ad ad = db.ads.Find(id); if (ad == null) { return(HttpNotFound()); } return(View(ad)); }
public async Task <ActionResult> Edit([Bind(Include = "id,title,imageURL,category,publishedDate")] ad ad) { if (ModelState.IsValid) { db.Entry(ad).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(ad)); }
public ActionResult viewad(int id, string username) { if (Session["user"] == null) { return(RedirectToAction("Login", "account")); } ad ad = user.getad(id, username); ViewBag.username = ad.user; return(View(ad)); }
public ActionResult newad(string username) { if (Session["user"] == null) { return(RedirectToAction("Login", "account")); } ViewBag.username = username; ViewBag.Catagory = user.get_catagories(); ad a = new ad(); return(View(a)); }
//返回ad对象 private ad generateAd(dynamic d) { ad n = new ad(); n.id = d["id"].ToString(); n.adCover = util.generateImage(d["adCover"].ToString()); n.adLink = d["adLink"].ToString(); n.state = Convert.ToInt32(d["state"].ToString()); n.create_time = d["create_time"].ToString(); return(n); }
////////////////////////////////Detail///////// public ActionResult Details(int id = 0) { ad ad = db.ads.Find(id); Session["Mail"] = ad.e_mail; Session["ID"] = id; if (ad == null) { return(HttpNotFound()); } return(View(ad)); }
public ActionResult Edit(ad ad) { if (ModelState.IsValid) { db.Entry(ad).State = EntityState.Modified; db.SaveChanges(); return(Redirect("/Regester/AfterLogin")); } ViewBag.area_id = new SelectList(db.areas, "area_id", "name", ad.area_id); ViewBag.user_id = new SelectList(db.users, "user_id", "name", ad.user_id); return(View(ad)); }
public ActionResult Edit(int id = 0) { ad ad = db.ads.Find(id); if (ad == null) { return(HttpNotFound()); } ViewBag.area_id = new SelectList(db.areas, "area_id", "name", ad.area_id); ViewBag.user_id = new SelectList(db.users, "user_id", "name", ad.user_id); return(View(ad)); }
public bool CheckLogin(string username, string password) { ad admin = db.ads.SingleOrDefault(n => n.username == username && n.password == password); if (admin == null) { return(false); } else { return(true); } }
// GET: ads/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ad ad = await db.ad.FindAsync(id); if (ad == null) { return(HttpNotFound()); } return(View(ad)); }
public ActionResult SaveAd(ad a) { for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFileBase file = Request.Files[i]; file.SaveAs(Server.MapPath(@"~\images\" + a.Id + file.FileName)); a.image = @"\images\" + a.Id + file.FileName; } int adId = obj.IpostAd(a); if (Session["name"] != null) { obj3.saveUserAdData(adId, int.Parse(Session["userId"].ToString())); } return(RedirectToAction("Index", "Home")); }
public async Task <ActionResult> Create([Bind(Include = "id,title,imageURL,category,publishedDate")] ad ad, HttpPostedFileBase photo) { if (ModelState.IsValid) { PhotoService photoservice = new PhotoService(); photoservice.CreateAndConfigureAsync(); ad.imageURL = await photoservice.UploadPhotoAsync(photo); ad.publishedDate = DateTime.UtcNow; db.Ads.Add(ad); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(ad)); }
public IHttpActionResult EditPost(ad _ad) { var post = db.ad.Where(r => r.ad_id == _ad.ad_id).FirstOrDefault <ad>(); if (post != null) { post.title = _ad.title; post.category_id = _ad.category_id; post.description = _ad.description; post.price = _ad.price; post.image_url = _ad.image_url; db.SaveChanges(); return(Ok()); } else { return(NotFound()); } }
// GET: /ad/Details/5 public ActionResult Details(int id = 0) { ad ad = db.ads.Find(id); Session["a"] = id; view add = db.views.Find(id); add.org = add.VId + 1; add.VId = add.org; // var userResults = from u in db.views // where u.ad_id == id // // select u.VId; //foreach (var a in userResults) //{ // int ab= (int)add.VId; //} db.Entry(add).State = EntityState.Modified; // db.views.Add(addd); db.SaveChanges(); if (ad == null) { return(HttpNotFound()); } return(View(ad)); }
public ActionResult Edit(ad newVal) { obj2.EditAd(newVal); return(RedirectToAction("Index", "Home")); }
public ActionResult Create(ad ad) { ///////// Module for not Posting the add again and again//////////////// /*if (ModelState.IsValid) * { * * * using (BSEntities8 da = new BSEntities8()) * { * * var ab = da.ads.Where(a => a.catagory.Equals(ad.catagory) && a.description.Equals(ad.description) && a.title.Equals(ad.title)).FirstOrDefault(); * * if (ab != null) * { * // ModelState.AddModelError("", "The Ad You have entered is already submitted thanks for anticipation"); * * Session["error"] = "The Ad Youhave submitted is already On Paksell thanks for the Anticipation"; * Redirect("ad/create"); * * * * } * * * } * * } * * */ var Data = db.ads.Add(ad); Data.ad_id = ad.ad_id; Data.area_id = ad.area_id; Data.catagory = ad.catagory; Data.cityId = ad.cityId; Data.date = System.DateTime.Now; Data.description = ad.description; Data.title = ad.title; Data.phone = ad.phone; Data.e_mail = Session["Email"].ToString(); Data.user_id = (int)Session["LogedUserID"]; Data.name = Session["LogedUserFullname"].ToString(); int i = 0; foreach (string file in Request.Files) { HttpPostedFileBase hpf = Request.Files[file] as HttpPostedFileBase; if (hpf.ContentLength == 0) { continue; } string saveFileName = Path.GetFileName(hpf.FileName); string location = Path.Combine(Server.MapPath("~/Images/" + @"\" + saveFileName)); Request.Files[file].SaveAs(location); if (i >= 2) { i = 0; } // Count + 1 each time i++; if (i == 1) { Data.url1 = saveFileName; } else if (i == 2) { Data.url3 = saveFileName; } } if (ModelState.IsValid) { db.ads.Add(ad); db.SaveChanges(); using (BSEntities8 dc = new BSEntities8()) { if (dc.Iusers != null) { foreach (var v in dc.Iusers) { var s = dc.Iusers.Where(a => a.Scat.Equals(Data.catagory) && a.Sitem.Equals(Data.title)).FirstOrDefault(); { if (s != null) { string cat = s.Scat; string item = s.Sitem; string phone = Data.phone.ToString(); string message = "Your intrested item posted cat is " + cat + "and item is:" + item + "and the cell number is" + phone; var twilio = new TwilioRestClient("ACfb4f763d08b8e11d5f5937fc052a6464", "c97a3b969fd6fe2bdc8f83fa61f3f465"); var call = twilio.InitiateOutboundCall("+1555456790", "+15551112222", "http://example.com/handleCall"); var msg = twilio.SendMessage("+14843027060", "+923237575485", message); } } } } } return(RedirectToAction("/AfterLogin")); } ViewBag.area_id = new SelectList(db.areas, "area_id", "name", ad.area_id); ViewBag.user_id = new SelectList(db.users, "user_id", "name", ad.user_id); ViewBag.cityId = new SelectList(db.cities, "cityId", "CityName", ad.cityId); return(View()); }
// Update is called once per frame void Update() { if (!bgms.audioBegin && SaveLoad.sound) { bgms.playBGM(); } else if (bgms.audioBegin && !SaveLoad.sound) { bgms.stopBGM(); } if (SaveLoad.sound) { Sound.sprite = on; } else { Sound.sprite = off; } if (score > SaveLoad.highscore) { highScoretext.text = "HIGH " + score; } else if (gameover && score <= SaveLoad.highscore) { highScoretext.text = "HIGH " + SaveLoad.highscore; } else { highScoretext.text = ""; } deadButtonControl(gameover); if (!started) { Touch startTouch = Input.GetTouch(0); if (startTouch.phase == TouchPhase.Began) { logo.enabled = false; ind.enabled = false; scoretext.enabled = true; started = true; startTime = Time.time; Sound.enabled = false; } } if (!gameover) { score = Mathf.Round((Time.time - startTime) * 100f) / 100f; if (Time.time - startTime < 10f) { moveSpeed = 0.013f + Mathf.Lerp(0f, 0.007f, (Time.time - startTime) / 10f); } else if (Time.time - startTime > 10f && Time.time - startTime < 15f) { moveSpeed = 0.02f + Mathf.Lerp(0f, 0.005f, ((Time.time - startTime) - 10f) / 5f); } else if (Time.time - startTime > 15f) { moveSpeed = 0.025f; } Debug.Log(moveSpeed); SaveLoad.updateHighScore(score); scoretext.text = "" + score.ToString("F2"); } if (started && !gameover) { ////////////////////////////////////// if (!moving) { StartCoroutine(moveFinger()); } if (Input.touchCount > 0 && !isPattern3) { Touch touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Began || touch.phase == TouchPhase.Stationary || touch.phase == TouchPhase.Moved) { Vector2 touchedPos = Camera.main.ScreenToWorldPoint(new Vector2(touch.position.x, touch.position.y)); RaycastHit2D hitInfo = Physics2D.Raycast(touchedPos, Camera.main.transform.forward); if (hitInfo.collider != null) { GameObject touchedObject = hitInfo.transform.gameObject; Debug.Log("Touched " + touchedObject.transform.name); gameover = false; } else { gameover = true; } } else { gameover = true; } if (touch.phase == TouchPhase.Began && SaveLoad.sound) { audioS.PlayOneShot(tap); } } if (Input.touchCount > 0) { Touch touch = Input.GetTouch(0); Vector2 touchedPos = Camera.main.ScreenToWorldPoint(new Vector2(touch.position.x, touch.position.y)); birtual.transform.position = new Vector3(touchedPos.x, touchedPos.y, 0f) + new Vector3(5, 0, -1); } else { birtual.transform.position = new Vector3(5, 0, 10); } } if (hand.transform.rotation.y > 0.28 && Input.touchCount > 0) { gameover = true; } // gameover check and action if (gameover) { if (Social.localUser.authenticated) { Social.ReportProgress("CgkIqMDE0r4GEAIQAg", 100.0f, (bool success) => { }); } Sound.enabled = true; SaveLoad.updateHighScore(score); Time.timeScale = 0; if (!incremented) { incremented = true; SaveLoad.adCounter++; if (SaveLoad.adCounter > 5) { if (Social.localUser.authenticated) { Social.ReportProgress("CgkIqMDE0r4GEAIQBQ", 100.0f, (bool success) => { }); } SaveLoad.adCounter = 0; SaveLoad.interstitialAdCnt++; ad Ads = GameObject.Find("unityad").GetComponent <ad>(); if (SaveLoad.interstitialAdCnt > 6) { Ads.ShowRewardedAd(); } else { Ads.ShowAd(); } } SaveLoad.save(); } } /////////////////////////////////// }
private void materialFlatButton1_Click(object sender, EventArgs e) { ad dc = new ad(); showContol(dc); }
select(ad, ad.AttributeClass)).FirstOrDefault();
public ActionResult Index(string searchString, string catagory, string Area, string pro, int page = 1, int sort = 0) { var Ads = from s in db.ads select s; if (!String.IsNullOrWhiteSpace(searchString) && catagory != String.Empty && Area != String.Empty) { Ads = Ads.Where(b => b.title.ToUpper().Contains(searchString.ToUpper()) && b.catagory == catagory && b.city.cityName == Area); } else if (!String.IsNullOrWhiteSpace(catagory) && searchString == String.Empty && Area == String.Empty) { Ads = Ads.Where(b => b.catagory == catagory); } else if (String.IsNullOrWhiteSpace(catagory) && searchString != String.Empty && Area == String.Empty) { Ads = Ads.Where(b => b.title.ToUpper().Contains(searchString.ToUpper())); } else if (!String.IsNullOrWhiteSpace(catagory) && searchString == String.Empty && Area != String.Empty) { Ads = Ads.Where(b => b.catagory == catagory && b.city.cityName == Area); } else if (String.IsNullOrWhiteSpace(catagory) && searchString == String.Empty && Area != String.Empty) { Ads = Ads.Where(b => b.city.cityName == Area); } else if (String.IsNullOrWhiteSpace(catagory) && searchString == String.Empty && Area == String.Empty && pro != String.Empty) { Ads = Ads.Where(b => b.area.name.ToUpper().Contains(pro.ToUpper())); } // if (city != String.Empty) // { // Ads = Ads.Where(b => b.city == city); //} //if (pro != String.Empty) //{ // var area = from t in db.areas // select t; //area = area.Where(b => b.name == pro); // } else if (sort == 1 && String.IsNullOrWhiteSpace(catagory) && searchString == String.Empty && Area == String.Empty && pro != String.Empty) { Ads = Ads.Where(b => b.area.name.ToUpper().Contains(pro.ToUpper())); } if (sort == 1) { return(View(Ads.OrderByDescending(v => v.date).ToPagedList(page, 6))); } else if (sort == 2) { return(View(Ads.OrderBy(v => v.price).ToPagedList(page, 6))); } int id = 0; Photo add = db.Photos.Find(id); Session["1"] = add.path; Session["2"] = add.name; // var r =(from u in db.reports // join ad v on u.ad_id equals v.ad_id // select new{ u,v}).ToList(); var graph = db.reports.Include("ad").ToList(); ad ad1 = new ad(); Session["3"] = graph.Where(u => u.adId == ad1.ad_id); var ads = db.ads.Include(a => a.area).Include(a => a.user); return(View(Ads.OrderByDescending(v => v.ad_id).ToPagedList(page, 6))); }