Пример #1
0
        public async Task <uint> Add([FromBody] RoleAddRequestVM requestVM)
        {
            ApplicationRole request = requestVM.ConvertAdd();

            var applicationRoleId = await this.RoleApplication.Add(request);

            return(applicationRoleId);
        }
        /// <summary>
        /// ConvertAdd converts object of RoleAddRequestVM type to State type.
        /// </summary>
        /// <param name="vm"></param>
        /// <returns></returns>
        public static ApplicationRole ConvertAdd(this RoleAddRequestVM vm)
        {
            var model = new ApplicationRole
            {
                RoleId              = vm.RoleId,
                RoleName            = vm.RoleName,
                RoleNameCode        = vm.RoleNameCode,
                RoleNameTranslation = vm.RoleNameTranslation ?? "",
                Active              = vm.Active,
                CreatedById         = vm.CurrentUserId
            };

            return(model);
        }