Esempio n. 1
0
 public static async Task <Movie> AddMovieDTOToMovie(AddMovieDTO addMovieDTO)
 {
     return(new Movie()
     {
         Title = addMovieDTO.Title.Trim(),
         Description = addMovieDTO.Description.Trim(),
         Genre = addMovieDTO.Genre,
         Cover = await FileToByteArray.ImageToByteArray(addMovieDTO.Cover)
     });
 }
Esempio n. 2
0
 public static async Task <User> RegisterDTOToUser(RegisterDTO registerDTO)
 {
     return(new User()
     {
         FirstName = registerDTO.FirstName.Trim(),
         LastName = registerDTO.LastName.Trim(),
         Email = registerDTO.Email.Trim(),
         ProfilePicture = await FileToByteArray.ImageToByteArray(registerDTO.ProfilePicture),
         UserName = registerDTO.Email + RandomString.GenerateRandomString(4)
     });
 }
Esempio n. 3
0
        public static async Task <User> UpdatePersonalDTOToUser(UpdatePersonalDTO personalDTO, User user)
        {
            user.FirstName = personalDTO.FirstName;
            user.LastName  = personalDTO.LastName;

            if (personalDTO.ProfilePicture != null)
            {
                user.ProfilePicture = await FileToByteArray.ImageToByteArray(personalDTO.ProfilePicture);
            }

            return(user);
        }
Esempio n. 4
0
        public static async Task <Movie> EditMovieDTOToMovie(EditMovieDTO addMovieDTO, Movie movie)
        {
            movie.Title       = addMovieDTO.Title.Trim();
            movie.Description = addMovieDTO.Description.Trim();
            movie.Genre       = addMovieDTO.Genre;

            if (addMovieDTO.Cover != null)
            {
                movie.Cover = await FileToByteArray.ImageToByteArray(addMovieDTO.Cover);
            }

            return(movie);
        }