Example #1
0
 private ClaimTypeViewModel ToModel(ClaimType entity)
 {
     return(new ClaimTypeViewModel
     {
         Id = entity.Id,
         Name = entity.Name,
         Description = entity.Description
     });
 }
Example #2
0
        public async Task <Guid> CreateAsync(ClaimTypeViewModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            // TODO: Check whether name already exists
            var claimType = ClaimType.Create(model.Name, model.Description);

            this.context.ClaimTypes.Add(claimType);

            await this.context.SaveChangesAsync();

            return(claimType.Id);
        }