Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            comp comp = db.comps.Find(id);

            db.comps.Remove(comp);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "compId,userId,firstPlayerId,secondPlayerId,exp")] comp comp)
 {
     if (ModelState.IsValid)
     {
         db.Entry(comp).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.userId = new SelectList(db.userProfiles, "userId", "userName", comp.userId);
     return(View(comp));
 }
Exemple #3
0
 public compViewModel(comp pairing, footballAPI footballApi)
 {
     userProfile       = pairing.userProfile;
     firstPlayer       = footballApi.GetDetails(pairing.firstPlayerId);
     firstPlayerScore  = pairing.scores.Count(s => s.isFirstPlayerBetter);
     secondPlayerScore = pairing.scores.Count(s => !s.isFirstPlayerBetter);
     secondPlayer      = footballApi.GetDetails(pairing.secondPlayerId);
     //scores = pairing.scores.ToList();
     comments = pairing.comments.ToList();
     compId   = pairing.compId;
 }
Exemple #4
0
        public ActionResult Create([Bind(Include = "compId,userId,firstPlayerId,secondPlayerId,exp")] comp comp)
        {
            if (ModelState.IsValid)
            {
                db.comps.Add(comp);
                db.SaveChanges();
                return(RedirectToAction("Account", "Home"));
            }

            ViewBag.userId = new SelectList(db.userProfiles, "userId", "userName", comp.userId);
            return(View(comp));
        }
Exemple #5
0
        // GET: comps/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            comp comp = db.comps.Find(id);

            if (comp == null)
            {
                return(HttpNotFound());
            }
            return(View(comp));
        }
Exemple #6
0
        public ActionResult company(comp ob)
        {
            if (ModelState.IsValid)
            {
                registrationEntities std = new registrationEntities();
                std.sp_company(ob.id, ob.compname, ob.address, ob.phone, ob.email, ob.password);
                ob.msg = ("successfully registered");
                ModelState.Clear();


                return(View("companyreg", ob));
            }
            return(View("companyreg", ob));
        }
Exemple #7
0
        // GET: comps/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            comp comp = db.comps.Find(id);

            if (comp == null)
            {
                return(HttpNotFound());
            }
            ViewBag.userId = new SelectList(db.userProfiles, "userId", "userName", comp.userId);
            return(View(comp));
        }
Exemple #8
0
        public ActionResult Confirmation(int playerOneId, int playerTwoId)
        {
            var existingComp = db.comps.Where(c => c.firstPlayerId == playerOneId && c.secondPlayerId == playerTwoId).FirstOrDefault(c => c.exp > DateTime.Now);

            if (existingComp != null)
            {
                return(RedirectToAction("Details", "Home", new { id = existingComp.compId }));
            }
            var comp = new comp
            {
                exp            = DateTime.Today.AddDays((DayOfWeek.Tuesday - DateTime.Today.DayOfWeek + 6) % 7 + 1),
                firstPlayerId  = playerOneId,
                secondPlayerId = playerTwoId,
                userId         = User.Identity.GetUserId()
            };

            db.comps.Add(comp);
            db.SaveChanges();
            return(RedirectToAction("Account", "Home"));
        }
Exemple #9
0
 var(comp, _, exceptionDiagnostics) = await TestCaseCompilation.CreateCompilation(src, analyzerOptions, additionalReferences);
 static byte InterComp(Color a, Color b, double lambda, comp co)
 {
     return((byte)(co(a) + (co(b)
                            - co(a)) * lambda));
 }