コード例 #1
0
        private async Task <TypePermission> CreatePermission(TypePermissionDto permission)
        {
            var _typepermission = new  TypePermission {
                Description = permission.Description
            };

            //set identity
            _typepermission.ChangeCurrentIdentity(permission.Id);

            return(_typepermission);
        }
コード例 #2
0
        private async Task <TypePermission> MaterializepPermissionFromDto(TypePermissionDto permission)
        {
            var _typePermission = await _solicitudDbContext.FindByKey <TypePermission>(permission.Id);

            _typePermission.ChangeCurrentIdentity(permission.Id);

            var _current = new TypePermission {
                Description = permission.Description
            };

            _current.ChangeCurrentIdentity(permission.Id);

            return(_current);
        }
コード例 #3
0
        public async Task <IActionResult> Update([FromQuery] UpdateTypePermissionCommand cmd, TypePermissionDto typepermission)
        {
            try
            {
                if (typepermission == null)
                {
                    ModelState.AddModelError("", "El tipo de permiso no puede ser en blanco");
                    return(BadRequest(ModelState));
                }

                cmd.TypePermission = typepermission;
                return(Ok(await _mediator.Send(cmd)));
            }
            catch (HttpRequestExceptionEx ex)
            {
                return(new NotFoundObjectResult(string.Format("Status code: {0} Message: {1}", ex.HttpCode, ex.Message)));
            }
        }