private void btnDeleteFormat_Click(object sender, EventArgs e) { if (lbxFormats.SelectedItem != null) { try { Format selectedFormat = (Format)lbxFormats.SelectedItem; formatManager.Delete(selectedFormat.Name); LoadFormatsAndStyleClasses(); } catch (MissingFormatException exception) { MessageBox.Show(exception.Message); } } }
public IHttpActionResult Delete([FromUri] string format_name) { if (IsTokenValid() && authenticationService.IsAllowedToDeleteFormats(GetTokenUserEmail())) { try { formatManagementService.Delete(format_name); return(Ok(format_name)); } catch (MissingFormatException e) { return(BadRequest(e.Message)); } catch (Exceptions e) { return(BadRequest(e.Message)); } } return(Unauthorized()); }