Exemplo n.º 1
0
        public IHttpActionResult Put(WrSeasonStatEdit season)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            WrSeasonStatService service = new WrSeasonStatService();

            if (!service.UpdateWrSeasonStats(season))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
Exemplo n.º 2
0
        //UPDATE
        public bool UpdateWrSeasonStats(WrSeasonStatEdit season)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .WrSeasonStats
                    .Single(s => s.WrSeasonId == season.WrSeasonId && s.IsDeleted == false);

                entity.PlayerId        = season.PlayerId;
                entity.Year            = season.Year;
                entity.Receptions      = season.Receptions;
                entity.Targets         = season.Targets;
                entity.Drops           = season.Drops;
                entity.ReceivingYards  = season.ReceivingYards;
                entity.YardsAfterCatch = season.YardsAfterCatch;
                entity.Touchdowns      = season.Touchdowns;
                entity.PlayerNumber    = season.PlayerNumber;
                entity.Team            = season.Team;

                return(ctx.SaveChanges() == 1);
            }
        }