public async Task <IHttpActionResult> PutballotResult(int id, ballotResult ballotResult)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != ballotResult.ballotID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> GetballotResult(int id)
        {
            ballotResult ballotResult = await db.ballotResults.FindAsync(id);

            if (ballotResult == null)
            {
                return(NotFound());
            }

            return(Ok(ballotResult));
        }
        public async Task <IHttpActionResult> PostballotResult(ballotResult ballotResult)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ballotResults.Add(ballotResult);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = ballotResult.ballotID }, ballotResult));
        }
        public async Task <IHttpActionResult> DeleteballotResult(int id)
        {
            ballotResult ballotResult = await db.ballotResults.FindAsync(id);

            if (ballotResult == null)
            {
                return(NotFound());
            }

            db.ballotResults.Remove(ballotResult);
            await db.SaveChangesAsync();

            return(Ok(ballotResult));
        }