コード例 #1
0
        public async Task <int> CreateAsync(CreateContributorViewModel createContributorViewModel, string userId)
        {
            var contributor = new Contributor
            {
                Prefix           = createContributorViewModel.Prefix,
                FirstName        = createContributorViewModel.FirstName,
                MiddleName       = createContributorViewModel.MiddleName,
                LastName         = createContributorViewModel.LastName,
                Credentials      = createContributorViewModel.Credentials,
                Suffix           = createContributorViewModel.Suffix,
                YearOfBirth      = createContributorViewModel.YearOfBirth.GetValueOrDefault(),
                YearOfDeath      = createContributorViewModel.YearOfDeath.GetValueOrDefault(),
                CreatedById      = userId,
                LastModifiedById = userId,
                DateCreated      = DateTime.Now,
                DateLastModified = DateTime.Now
            };

            return(await _contributorRepository.CreateAsync(contributor));
        }