Пример #1
0
        public Team Put(int id, [FromBody] Team value)
        {
            var oldTeam = ctx.Teams.Find(id);

            if (oldTeam != null)
            {
                oldTeam.TeamName          = value.TeamName;
                oldTeam.TeamNumber        = value.TeamNumber;
                oldTeam.CoachFirstName    = value.CoachFirstName;
                oldTeam.CoachLastName     = value.CoachLastName;
                oldTeam.CoachEmail        = value.CoachEmail;
                oldTeam.AltCoachFirstName = value.AltCoachFirstName;
                oldTeam.AltCoachlastName  = value.AltCoachlastName;
                oldTeam.AltCoachEmail     = value.AltCoachEmail;
                oldTeam.City    = value.City;
                oldTeam.State   = value.State;
                oldTeam.Updated = DateTime.Now;
                ctx.Update(oldTeam);
                ctx.SaveChanges();
            }
            return(oldTeam);
        }