public ActionResult DeleteConfirmed(Guid id) { cooler cooler = db.coolers.Find(id); db.coolers.Remove(cooler); db.SaveChanges(); return(RedirectToAction("Index")); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (hit.collider.gameObject.GetComponent <cooler>() != null) { if (_cooler != null) { if (hit.collider.gameObject.GetComponent <cooler>() == _cooler) { //clicked on same cooler Debug.Log("same"); if (_isActive) { _isActive = false; canvas.SetActive(false); return; } } } _cooler = hit.collider.gameObject.GetComponent <cooler>(); Vector3 _coolerPos = _cooler.gameObject.transform.position; transform.position = new Vector3(_coolerPos.x, _coolerPos.y + 2, _coolerPos.z); _isActive = true; canvas.SetActive(true); } else { if (_isActive) { _isActive = false; canvas.SetActive(false); return; } } } } if (_cooler != null) { //set stats: coolerName.text = _cooler.coolerName; coolText.text = "Cooling Capacity: " + (_cooler.coolingFactor * 1000).ToString("F2"); SellText.text = "Sell: $" + _cooler.sellPrice.ToString(); } }
public ActionResult Edit([Bind(Include = "GID,Name,Specs,Image,Manufacture,cat_cooler_id")] cooler cooler) { var myrole = new Class1(); var userID = User.Identity.GetUserId(); ViewBag.currentrole = myrole.a(userID); if (ModelState.IsValid) { db.Entry(cooler).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.cat_cooler_id = new SelectList(db.CategoryCoolers, "cat_cooler_id", "cat_cooler_name", cooler.cat_cooler_id); return(View(cooler)); }
public ActionResult Details(Guid?id) { var myrole = new Class1(); var userID = User.Identity.GetUserId(); ViewBag.currentrole = myrole.a(userID); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } cooler cooler = db.coolers.Find(id); if (cooler == null) { return(HttpNotFound()); } return(View(cooler)); }
public ActionResult Edit(Guid?id) { var myrole = new Class1(); var userID = User.Identity.GetUserId(); ViewBag.currentrole = myrole.a(userID); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } cooler cooler = db.coolers.Find(id); if (cooler == null) { return(HttpNotFound()); } ViewBag.cat_cooler_id = new SelectList(db.CategoryCoolers, "cat_cooler_id", "cat_cooler_name", cooler.cat_cooler_id); return(View(cooler)); }