Пример #1
0
        // GET: Actor/Edit/5
        public ActionResult Edit(int?id)
        {
            if (!isAdminUser())
            {
                return(RedirectToAction("Index", "Main"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ActorLocation al = dbLogic.GetActorLocation((int)id);

            if (al == null)
            {
                ViewBag.HasLocation = "False";
            }
            else
            {
                ViewBag.HasLocation = "True";
            }
            Actor actor = dbLogic.GetActorById((int)id);

            if (actor == null)
            {
                return(HttpNotFound());
            }
            return(View(actor));
        }
Пример #2
0
        public ActionResult Edit(int?id, [Bind(Include = "ActorLocationId,Lat,Long")] ActorLocation actorLocation)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Main"));
            }
            if (!isAdminUser())
            {
                return(RedirectToAction("Index", "Main"));
            }

            if (ModelState.IsValid)
            {
                actorLocation.ActorId = (int)id;
                dbLogic.UpdateActorLocation(actorLocation);
                dbLogic.SaveChanges();
                return(RedirectToAction("Index", "Main"));
            }
            Actor act = dbLogic.GetActorById((int)id);

            if (act == null)
            {
                return(RedirectToAction("Index", "Main"));
            }
            ViewBag.ActorId   = (int)id;
            ViewBag.ActorName = act.ActorName;
            return(View(actorLocation));
        }
Пример #3
0
        // GET: Actor/Details/5
        public ActionResult GetActorById(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (User.Identity.IsAuthenticated)
            {
                dbLogic.AddActorVisit((int)id, User.Identity.GetUserName());
                dbLogic.SaveChanges();
            }
            ViewBag.HasLocation = "True";
            ActorLocation al = dbLogic.GetActorLocation((int)id);

            if (al == null)
            {
                ViewBag.HasLocation = "False";
            }
            else
            {
                ViewBag.HasLocation = "True";
                ViewBag.Lat         = al.Lat;
                ViewBag.Long        = al.Long;
            }
            Actor actor = dbLogic.GetActorById((int)id);

            if (actor == null)
            {
                return(HttpNotFound());
            }
            return(View(actor));
        }
Пример #4
0
        // GET: ActorLocation/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Main"));
            }
            if (!isAdminUser())
            {
                return(RedirectToAction("Index", "Main"));
            }

            ActorLocation actorLocation = dbLogic.GetActorLocation((int)id);

            if (actorLocation == null)
            {
                return(RedirectToAction("Index", "Main"));
            }
            Actor a = dbLogic.GetActorById((int)id);

            if (a == null)
            {
                return(RedirectToAction("Index", "Main"));
            }
            ViewBag.Address   = a.PlaceOfBirth;
            ViewBag.ActorId   = (int)id;
            ViewBag.ActorName = a.ActorName;
            return(View(actorLocation));
        }
Пример #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            ActorLocation actorLocation = dbLogic.GetActorLocation(id);

            dbLogic.DeleteActorLocation(actorLocation);
            dbLogic.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #6
0
        public void ActorLocationInequality()
        {
            Location loc1 = new ActorLocation (new MockActor ());
            Location loc2 = new ActorLocation (new MockActor ());

            Assert.IsFalse (loc1.Equals (loc2));
            Assert.IsFalse (loc1 == loc2);
            Assert.IsTrue (loc1 != loc2);
        }
Пример #7
0
        // GET: ActorLocation/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Main"));
            }
            if (isAdminUser())
            {
                return(RedirectToAction("Index", "Main"));
            }

            ActorLocation actorLocation = dbLogic.GetActorLocation((int)id);

            if (actorLocation == null)
            {
                return(HttpNotFound());
            }
            return(View(actorLocation));
        }
Пример #8
0
        public ActionResult Create(int?id, [Bind(Include = "ActorLocationId,Lat,Long")] ActorLocation actorLocation)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Main"));
            }

            if (!isAdminUser())
            {
                return(RedirectToAction("Index", "Main"));
            }

            if (ModelState.IsValid)
            {
                actorLocation.ActorId = (int)id;
                dbLogic.AddActorLocation(actorLocation);
                dbLogic.SaveChanges();
                return(RedirectToAction("GetAllActors", "Actor"));
            }

            return(View(actorLocation));
        }
Пример #9
0
 public void UpdateActorLocation(ActorLocation e)
 {
     db.Entry(e).State = EntityState.Modified;
 }
Пример #10
0
 public void AddActorLocation(ActorLocation e)
 {
     db.ActorLocation.Add(e);
 }
Пример #11
0
 public void DeleteActorLocation(ActorLocation e)
 {
     db.ActorLocation.Remove(e);
 }
Пример #12
0
 static Patterns()
 {
     propertyMappings["chest_upperLeftCenter"]      = new ActorLocation(Vibration.Region.Chest, 2);
     propertyMappings["chest_upperFarLeft"]         = new ActorLocation(Vibration.Region.Chest, 3);
     propertyMappings["chest_middleLeftCenter"]     = new ActorLocation(Vibration.Region.Chest, 6);
     propertyMappings["chest_middleFarLeft"]        = new ActorLocation(Vibration.Region.Chest, 7);
     propertyMappings["chest_lowerLeftCenter"]      = new ActorLocation(Vibration.Region.Chest, 10);
     propertyMappings["chest_lowerFarLeft"]         = new ActorLocation(Vibration.Region.Chest, 11);
     propertyMappings["chest_upperFarRight"]        = new ActorLocation(Vibration.Region.Chest, 0);
     propertyMappings["chest_upperRightCenter"]     = new ActorLocation(Vibration.Region.Chest, 1);
     propertyMappings["chest_middleFarRight"]       = new ActorLocation(Vibration.Region.Chest, 4);
     propertyMappings["chest_middleRightCenter"]    = new ActorLocation(Vibration.Region.Chest, 5);
     propertyMappings["chest_lowerFarRight"]        = new ActorLocation(Vibration.Region.Chest, 8);
     propertyMappings["chest_lowerRightCenter"]     = new ActorLocation(Vibration.Region.Chest, 9);
     propertyMappings["back_upperFarLeft"]          = new ActorLocation(Vibration.Region.Back, 0);
     propertyMappings["back_upperLeftCenter"]       = new ActorLocation(Vibration.Region.Back, 1);
     propertyMappings["back_middleFarLeft"]         = new ActorLocation(Vibration.Region.Back, 4);
     propertyMappings["back_middleLeftCenter"]      = new ActorLocation(Vibration.Region.Back, 5);
     propertyMappings["back_lowerFarLeft"]          = new ActorLocation(Vibration.Region.Back, 8);
     propertyMappings["back_lowerLeftCenter"]       = new ActorLocation(Vibration.Region.Back, 9);
     propertyMappings["back_upperRightCenter"]      = new ActorLocation(Vibration.Region.Back, 2);
     propertyMappings["back_upperFarRight"]         = new ActorLocation(Vibration.Region.Back, 3);
     propertyMappings["back_middleRightCenter"]     = new ActorLocation(Vibration.Region.Back, 6);
     propertyMappings["back_middleFarRight"]        = new ActorLocation(Vibration.Region.Back, 7);
     propertyMappings["back_lowerRightCenter"]      = new ActorLocation(Vibration.Region.Back, 10);
     propertyMappings["back_lowerFarRight"]         = new ActorLocation(Vibration.Region.Back, 11);
     propertyMappings["leftArm_shoulderFront"]      = new ActorLocation(Vibration.Region.LeftArm, 0);
     propertyMappings["leftArm_shoulderSide"]       = new ActorLocation(Vibration.Region.LeftArm, 1);
     propertyMappings["leftArm_insideUpperArm"]     = new ActorLocation(Vibration.Region.LeftArm, 2);
     propertyMappings["leftArm_outsideUpperArm"]    = new ActorLocation(Vibration.Region.LeftArm, 3);
     propertyMappings["leftArm_upperForearmBack"]   = new ActorLocation(Vibration.Region.LeftArm, 4);
     propertyMappings["leftArm_lowerForearmFront"]  = new ActorLocation(Vibration.Region.LeftArm, 5);
     propertyMappings["leftArm_lowerForearmBack"]   = new ActorLocation(Vibration.Region.LeftArm, 6);
     propertyMappings["leftHand_thumb"]             = new ActorLocation(Vibration.Region.LeftHand, 0);
     propertyMappings["leftHand_indexFinger"]       = new ActorLocation(Vibration.Region.LeftHand, 1);
     propertyMappings["leftHand_middleFinger"]      = new ActorLocation(Vibration.Region.LeftHand, 2);
     propertyMappings["leftHand_ringFinger"]        = new ActorLocation(Vibration.Region.LeftHand, 3);
     propertyMappings["leftHand_pinkie"]            = new ActorLocation(Vibration.Region.LeftHand, 4);
     propertyMappings["leftHand_palm"]              = new ActorLocation(Vibration.Region.LeftHand, 5);
     propertyMappings["leftHand_backOfHand"]        = new ActorLocation(Vibration.Region.LeftHand, 6);
     propertyMappings["rightArm_shoulderFront"]     = new ActorLocation(Vibration.Region.RightArm, 0);
     propertyMappings["rightArm_shoulderSide"]      = new ActorLocation(Vibration.Region.RightArm, 1);
     propertyMappings["rightArm_insideUpperArm"]    = new ActorLocation(Vibration.Region.RightArm, 2);
     propertyMappings["rightArm_outsideUpperArm"]   = new ActorLocation(Vibration.Region.RightArm, 3);
     propertyMappings["rightArm_upperForearmBack"]  = new ActorLocation(Vibration.Region.RightArm, 4);
     propertyMappings["rightArm_lowerForearmFront"] = new ActorLocation(Vibration.Region.RightArm, 5);
     propertyMappings["rightArm_lowerForearmBack"]  = new ActorLocation(Vibration.Region.RightArm, 6);
     propertyMappings["rightHand_thumb"]            = new ActorLocation(Vibration.Region.RightHand, 0);
     propertyMappings["rightHand_indexFinger"]      = new ActorLocation(Vibration.Region.RightHand, 1);
     propertyMappings["rightHand_middleFinger"]     = new ActorLocation(Vibration.Region.RightHand, 2);
     propertyMappings["rightHand_ringFinger"]       = new ActorLocation(Vibration.Region.RightHand, 3);
     propertyMappings["rightHand_pinkie"]           = new ActorLocation(Vibration.Region.RightHand, 4);
     propertyMappings["rightHand_palm"]             = new ActorLocation(Vibration.Region.RightHand, 5);
     propertyMappings["rightHand_backOfHand"]       = new ActorLocation(Vibration.Region.RightHand, 6);
     propertyMappings["leftLeg_hip"]                = new ActorLocation(Vibration.Region.LeftLeg, 0);
     propertyMappings["leftLeg_buttock"]            = new ActorLocation(Vibration.Region.LeftLeg, 1);
     propertyMappings["leftLeg_upperThighOutside"]  = new ActorLocation(Vibration.Region.LeftLeg, 2);
     propertyMappings["leftLeg_upperThighFront"]    = new ActorLocation(Vibration.Region.LeftLeg, 3);
     propertyMappings["leftLeg_upperThighInside"]   = new ActorLocation(Vibration.Region.LeftLeg, 4);
     propertyMappings["leftLeg_upperThighBack"]     = new ActorLocation(Vibration.Region.LeftLeg, 5);
     propertyMappings["leftLeg_lowerThighOutside"]  = new ActorLocation(Vibration.Region.LeftLeg, 6);
     propertyMappings["leftLeg_lowerTighFront"]     = new ActorLocation(Vibration.Region.LeftLeg, 7);
     propertyMappings["leftLeg_lowerThighInside"]   = new ActorLocation(Vibration.Region.LeftLeg, 8);
     propertyMappings["leftLeg_lowerTighBack"]      = new ActorLocation(Vibration.Region.LeftLeg, 9);
     propertyMappings["leftLeg_upperShankOutside"]  = new ActorLocation(Vibration.Region.LeftLeg, 10);
     propertyMappings["leftLeg_upperShankFront"]    = new ActorLocation(Vibration.Region.LeftLeg, 11);
     propertyMappings["leftLeg_upperShankInside"]   = new ActorLocation(Vibration.Region.LeftLeg, 12);
     propertyMappings["leftLeg_upperShankBack"]     = new ActorLocation(Vibration.Region.LeftLeg, 13);
     propertyMappings["leftLeg_lowerShankOutside"]  = new ActorLocation(Vibration.Region.LeftLeg, 14);
     propertyMappings["leftLeg_lowerShankFront"]    = new ActorLocation(Vibration.Region.LeftLeg, 15);
     propertyMappings["leftLeg_lowerShankInside"]   = new ActorLocation(Vibration.Region.LeftLeg, 16);
     propertyMappings["leftLeg_lowerShankBack"]     = new ActorLocation(Vibration.Region.LeftLeg, 17);
     propertyMappings["rightLeg_hip"]               = new ActorLocation(Vibration.Region.RightLeg, 0);
     propertyMappings["rightLeg_buttock"]           = new ActorLocation(Vibration.Region.RightLeg, 1);
     propertyMappings["rightLeg_upperThighOutside"] = new ActorLocation(Vibration.Region.RightLeg, 2);
     propertyMappings["rightLeg_upperThighFront"]   = new ActorLocation(Vibration.Region.RightLeg, 3);
     propertyMappings["rightLeg_upperThighInside"]  = new ActorLocation(Vibration.Region.RightLeg, 4);
     propertyMappings["rightLeg_upperThighBack"]    = new ActorLocation(Vibration.Region.RightLeg, 5);
     propertyMappings["rightLeg_lowerThighOutside"] = new ActorLocation(Vibration.Region.RightLeg, 6);
     propertyMappings["rightLeg_lowerThighFront"]   = new ActorLocation(Vibration.Region.RightLeg, 7);
     propertyMappings["rightLeg_lowerThighInside"]  = new ActorLocation(Vibration.Region.RightLeg, 8);
     propertyMappings["rightLeg_lowerTighBack"]     = new ActorLocation(Vibration.Region.RightLeg, 9);
     propertyMappings["rightLeg_upperShankOutside"] = new ActorLocation(Vibration.Region.RightLeg, 10);
     propertyMappings["rightLeg_upperShankFront"]   = new ActorLocation(Vibration.Region.RightLeg, 11);
     propertyMappings["rightLeg_upperShankInside"]  = new ActorLocation(Vibration.Region.RightLeg, 12);
     propertyMappings["rightLeg_upperShankBack"]    = new ActorLocation(Vibration.Region.RightLeg, 13);
     propertyMappings["rightLeg_lowerShankOutside"] = new ActorLocation(Vibration.Region.RightLeg, 14);
     propertyMappings["rightLeg_lowerShankFront"]   = new ActorLocation(Vibration.Region.RightLeg, 15);
     propertyMappings["rightLeg_lowerShankInside"]  = new ActorLocation(Vibration.Region.RightLeg, 16);
     propertyMappings["rightLeg_lowerShankBack"]    = new ActorLocation(Vibration.Region.RightLeg, 17);
 }