コード例 #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            MyCompetition myCompetition = await db.MyCompetitions.FindAsync(id);

            db.MyCompetitions.Remove(myCompetition);
            await db.SaveChangesAsync();

            return(RedirectToAction("Competitions"));
        }
コード例 #2
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Date,Distance,Description,Link,DaysLeft")] MyCompetition myCompetition)
        {
            if (ModelState.IsValid)
            {
                db.Entry(myCompetition).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Competitions"));
            }
            return(View(myCompetition));
        }
コード例 #3
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Name,Date,Distance,Description,DaysLeft")] MyCompetition myCompetition)
        {
            if (ModelState.IsValid)
            {
                db.MyCompetitions.Add(myCompetition);
                await db.SaveChangesAsync();

                return(RedirectToAction("Competitions"));
            }

            return(View(myCompetition));
        }
コード例 #4
0
        // GET: MyCompetitions/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MyCompetition myCompetition = await db.MyCompetitions.FindAsync(id);

            if (myCompetition == null)
            {
                return(HttpNotFound());
            }
            return(View(myCompetition));
        }
コード例 #5
0
        // GET: MyCompetitions
        public async Task <ActionResult> Competitions(MyCompetition myCompetition)
        {
            //myCompetition.Date = myCompetition.Date.Date;

            return(View(await db.MyCompetitions.ToListAsync()));
        }