Example #1
0
        public async Task <IActionResult> AddWork(int userId, [FromBody] WorkDTO workForAddd)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            await _repo.AddWork(userId, workForAddd);

            return(Ok());
        }
 private void Add_Click(object sender, RoutedEventArgs e)
 {
     if (NewName.Text != "" & NewContent.Text != "")
     {
         workRepository.AddWork(NewName.Text, NewContent.Text, Int32.Parse(UserIdList.SelectedItem.ToString()));
         MessageBox.Show("Work saved correctly", "Saved");
     }
     else
     {
         MessageBox.Show("There is empty at least one empty box, fill it", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }