Exemplo n.º 1
0
        public async Task <IActionResult> UpdatePhotographer(int id, UpdatePhotographer photographer)
        {
            Logger.Log(LogLevel.Information, "UPDATE: Photographer with id %i, new data is %s", new { id, photographer });

            if (!ModelState.IsValid)
            {
                Logger.Log(LogLevel.Information, "UPDATE: Photographer with id %i, new data %s, failed!",
                           new { id, photographer });
                return(BadRequest());
            }

            await _picDb.UpdatePhotographer(new Photographer {
                Id        = id,
                FirstName = photographer.FirstName,
                LastName  = photographer.LastName,
                Birthday  = photographer.Birthday.Date,
                Notes     = photographer.Notes
            });

            return(Ok());
        }