public void Post(UserDTO modifiedUser)
        {
            using (var dc = CreateDbContext())
            {
                // Retrieve the entity from the database (using normal Entity Framework query)
                var user = FetchUserFromDatabase(dc, modifiedUser.Id);

                // Update the entity with the changes in the DTO.
                // We use the PopulateSource since we already have the source entity,
                // we just need to update its properties.
                modifiedUser.PopulateSource(user);

                // Save the changes.
                dc.SaveChanges();
            }
        }
 public static UserDTO TransformToUserDTO(this Models.User source)
 {
     DtoGen.Core.PropertyConverter.EnsureInitialized();
     UserDTO target = new UserDTO();
     target.Id = source.Id;
     target.Name = source.Name;
     target.SureName = source.SureName;
     target.Email = source.Email;
     target.Street = source.Street;
     target.City = source.City;
     target.ZIP = source.ZIP;
     target.State = source.State;
     target.Country = source.Country;
     target.TaxNumber = source.TaxNumber;
     target.FavoriteGenres = source.FavoriteGenres;
     target.Books = source.Books;
     return target;
 }
 public static void PopulateTarget(this Models.User source, UserDTO target)
 {
     DtoGen.Core.PropertyConverter.EnsureInitialized();
     target.Id = source.Id;
     target.Name = source.Name;
     target.SureName = source.SureName;
     target.Email = source.Email;
     target.Street = source.Street;
     target.City = source.City;
     target.ZIP = source.ZIP;
     target.State = source.State;
     target.Country = source.Country;
     target.TaxNumber = source.TaxNumber;
     target.FavoriteGenres = source.FavoriteGenres;
     target.Books = source.Books;
 }