public async Task <IActionResult> Post([FromBody] RoleDtos registerRole)
        {
            ApplicationRole r = new ApplicationRole();

            r.RoleName = registerRole.RoleName;


            var newRole = await _role.CreateRole(r);

            if (newRole)
            {
                return(Ok(new { message = "Role Created" }));
            }

            return(BadRequest(new { message = "Role not created" }));
        }
Example #2
0
 private void DataGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (DataGrid.SelectedIndex != -1)
     {
         FirstNameTextBox.Text     = FilteredEmployeeDtos[DataGrid.SelectedIndex].FirstName;
         LastNameTextBox.Text      = FilteredEmployeeDtos[DataGrid.SelectedIndex].LastName;
         PhoneNumberTextBox.Text   = FilteredEmployeeDtos[DataGrid.SelectedIndex].PhoneNumber;
         ExperienceTextBox.Text    = FilteredEmployeeDtos[DataGrid.SelectedIndex].WorkExperience.ToString();
         AddressTextBox.Text       = FilteredEmployeeDtos[DataGrid.SelectedIndex].Address;
         LoginTextBox.Text         = FilteredEmployeeDtos[DataGrid.SelectedIndex].Login;
         PasswordTextBox.Text      = FilteredEmployeeDtos[DataGrid.SelectedIndex].Password;
         RoleComboBox.SelectedItem =
             RoleDtos.FirstOrDefault(
                 item => item.Title == FilteredEmployeeDtos[DataGrid.SelectedIndex].RoleTitle);
         MarketComboBox.SelectedItem = MarketDtos.FirstOrDefault(item =>
                                                                 item.FullAddress == FilteredEmployeeDtos[DataGrid.SelectedIndex].FullMarketAddress);
         CityComboBox.SelectedItem =
             CityDtos.FirstOrDefault(
                 item => item.Title == FilteredEmployeeDtos[DataGrid.SelectedIndex].CityTitle);
     }
 }