Esempio n. 1
0
 public ActionResult Edit([Bind(Include = "RequestContextId,RaceId,AgeGroupId,GenderId,LastRequestedUTC,Status,Instruction,SourceCount")] RequestContext requestContext)
 {
     if (ModelState.IsValid)
     {
         _DBContext.Entry(requestContext).State = EntityState.Modified;
         _DBContext.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AgeGroupId = new SelectList(_DBContext.AgeGroups, "AgeGroupId", "Value", requestContext.AgeGroupId);
     ViewBag.GenderId   = new SelectList(_DBContext.Genders, "GenderId", "Value", requestContext.GenderId);
     ViewBag.RaceId     = new SelectList(_DBContext.Races, "RaceId", "RaceId", requestContext.RaceId);
     return(View(requestContext));
 }
        public async Task <IHttpActionResult> PutAgeGroup(int id, AgeGroup ageGroup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != ageGroup.AgeGroupId)
            {
                return(BadRequest());
            }

            db.Entry(ageGroup).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AgeGroupExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 3
0
        public async Task <IHttpActionResult> PutRace(string id, Race race)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != race.RaceId)
            {
                return(BadRequest());
            }

            _DBContext.Entry(race).State = EntityState.Modified;

            try
            {
                await _DBContext.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RaceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> PutGender(int id, Gender gender)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != gender.GenderId)
            {
                return(BadRequest());
            }

            db.Entry(gender).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!GenderExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "TagId,Type,Value")] Tag tag)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tag).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tag));
 }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "RaceAggregateId,RaceId,AthleteCount,DNFCount,MaleCount,FemaleCount,SwimMedian,BikeMedian,RunMedian,FinishMedian,SwimFastest,BikeFastest,RunFastest,FinishFastest,SwimSlowest,BikeSlowest,RunSlowest,FinishSlowest,SwimStdDev,BikeStdDev,RunStdDev,FinishStdDev")] RaceAggregate raceAggregate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(raceAggregate).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RaceId = new SelectList(db.Races, "RaceId", "BaseURL", raceAggregate.RaceId);
     return(View(raceAggregate));
 }
        public async Task <ActionResult> UpVote(int id, bool up)
        {
            AppFeature appFeature = db.AppFeatures.Find(id);

            if (appFeature == null)
            {
                return(Json(new { status = "Error" }));
            }

            if (up)
            {
                ++appFeature.VoteCount;
            }
            else
            {
                --appFeature.VoteCount;
            }


            db.Entry(appFeature).State = EntityState.Modified;
            await db.SaveChangesAsync();

            return(Json(new { status = "Success" }));
        }