// GET: Class/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }


            GUIClass guiClass = db.GUIClasses.Find(id);

            if (guiClass == null)
            {
                return(HttpNotFound());
            }


            string name = guiClass.name;

            // checking if target cid is listed as a parent ID for any other classes
            if (db.GUIClasses.Any(item => item.pid == id) == true)
            {
                // Create an error object
                ErrorHandling eh = new ErrorHandling
                {
                    ErrorNo         = 1,
                    TargetClassName = name
                };

                // Pass error object to Error view
                return(RedirectToAction("Error", eh));
            }

            // Pass target class to Delete View()
            return(View(guiClass));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            GUIClass guiClass = db.GUIClasses.Find(id);

            db.GUIClasses.Remove(guiClass);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "cid,name,pid,isAbstract")] GUIClass guiClass)
 {
     if (ModelState.IsValid)
     {
         db.Entry(guiClass).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(guiClass));
 }
        // GET: Class/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GUIClass guiClass = db.GUIClasses.Find(id);

            if (guiClass == null)
            {
                return(HttpNotFound());
            }
            return(View(guiClass));
        }
 public void SetWindowPos(GUIClass guiWindow, float x, float y)
 {
     guiWindow.rect.x = x;
     guiWindow.rect.y = y;
 }