void ReleaseDesignerOutlets()
        {
            if (TitleInput != null)
            {
                TitleInput.Dispose();
                TitleInput = null;
            }

            if (AuthorInput != null)
            {
                AuthorInput.Dispose();
                AuthorInput = null;
            }

            if (GenreInput != null)
            {
                GenreInput.Dispose();
                GenreInput = null;
            }

            if (ISBNInput != null)
            {
                ISBNInput.Dispose();
                ISBNInput = null;
            }

            if (LocationInput != null)
            {
                LocationInput.Dispose();
                LocationInput = null;
            }
        }
Example #2
0
 public static Model.Author ConvertAuthorInputToModelAuthor(AuthorInput authorInput)
 {
     return(new Model.Author()
     {
         Name = authorInput.Name,
         Email = authorInput.Email
     });
 }
Example #3
0
        public async Task <ListResultDto <AuthorListDto> > GetListAuthor(AuthorInput input)
        {
            var listAuthor = await _authorRepository.GetAll()
                             .WhereIf(input.Filter != null, t => t.FirstName.Contains(input.Filter) || t.LastName.Contains(input.Filter))
                             .OrderByDescending(t => t.CreationTime)
                             .ToListAsync();

            return(new ListResultDto <AuthorListDto>(
                       ObjectMapper.Map <List <AuthorListDto> >(listAuthor)));
        }
Example #4
0
        public Types.Author NewAuthor(ResolveFieldContext context, AuthorInput author)
        {
            if (author == null)
            {
                return(null);
            }

            var newAuthor = AuthorMapper.ConvertAuthorInputToModelAuthor(author);

            newAuthor = authorsDataSource.NewAuthor(newAuthor);

            return(AuthorMapper.ConvertModelAuthorToGraphQLAuthor(newAuthor, null));
        }
Example #5
0
        public ValueTask <Author> AddAuthor(
            AuthorInput input,
            CancellationToken cancellationToken = default)
        {
            var newAuthor = new Author(
                id: _idCounter++,
                userName: input.UserName,
                givenName: input.GivenName,
                familyName: input.FamilyName,
                email: input.Email,
                birthDate: input.BirthDate?.ToUniversalTime());

            _authors.Add(newAuthor.Id, newAuthor);
            return(new ValueTask <Author>(newAuthor));
        }
Example #6
0
        public Types.Author EditAuthor(int id, AuthorInput author)
        {
            if (author == null)
            {
                return(null);
            }

            var existingAuthor = authorsDataSource.GetAuthor(id);

            if (existingAuthor == null)
            {
                return(null);
            }

            existingAuthor.Name  = author.Name;
            existingAuthor.Email = author.Email;

            var books = booksDataSource.GetBooksByAuthor(id);

            return(AuthorMapper.ConvertModelAuthorToGraphQLAuthor(existingAuthor, books));
        }