public OperationResponse <AppUserRoleUpdateCommandOutputDTO> Execute(AppUserRoleUpdateCommandInputDTO input)
 {
     using (var dbContextScope = this.DbContextScopeFactory.Create())
     {
         return(this.Repository.Update(input));
     }
 }
        public OperationResponse <AppUserRoleUpdateCommandOutputDTO> Update(AppUserRoleUpdateCommandInputDTO input)
        {
            var result    = new OperationResponse <AppUserRoleUpdateCommandOutputDTO>();
            var dbLocator = AmbientDbContextLocator.Get <IdentityDBContext>();
            {
                var entity = dbLocator.Set <IdentityRole>().FirstOrDefault(o => o.Id == input.Id);
                if (entity != null)
                {
                    entity.Id             = input.Id;
                    entity.Name           = input.Name;
                    entity.NormalizedName = input.NormalizedName;
                }

                dbLocator.SaveChanges();


                var dbResult = dbLocator.Set <IdentityRole>().Where(o => o.Id == entity.Id).Select(o => new AppUserRoleUpdateCommandOutputDTO
                {
                    Id             = o.Id,
                    Name           = o.Name,
                    NormalizedName = o.NormalizedName,
                }).FirstOrDefault();

                result.Bag = dbResult;
                return(result);
            }
        }
        public IActionResult Put([FromBody] AppUserRoleUpdateCommandInputDTO model)
        {
            var appResult = this.UpdateCommand.Execute(model);

            return(appResult.IsSucceed ? (IActionResult)this.Ok(appResult) : (IActionResult)this.BadRequest(appResult));
        }