Beispiel #1
0
        public IHttpActionResult Update([FromUri] int id, [FromBody] DeveloperUpdateModel game)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _developerService = new DeveloperService();

            _developerService.UpdateDeveloper(id, game);

            return(Ok());
        }
Beispiel #2
0
        public void UpdateDeveloper(int id, DeveloperUpdateModel developerToUpdate)
        {
            using (ApplicationDbContext context = new ApplicationDbContext())
            {
                var developerWeWantToUpdate = context.Developers.Find(id);

                if (developerToUpdate != null)
                {
                    developerWeWantToUpdate.Name = developerToUpdate.Name;

                    context.SaveChanges();
                }
            }
        }