public override Response Delete(string objectType, IList <string> identifiers) { Response response = new Response(); if (identifiers == null || identifiers.Count == 0) { Status status = new Status(); status.Level = StatusLevel.Warning; status.Messages.Add("Nothing to delete."); response.Append(status); return(response); } try { foreach (string identifier in identifiers) { Status status = new Status(); status.Identifier = identifier; int id = 0; Int32.TryParse(identifier, out id); int result = _widgetProvider.DeleteWidgets(id); string message = String.Empty; if (result == 0) { message = String.Format( "DataObject [{0}] deleted successfully.", identifier ); } else { message = String.Format( "Error while deleting dataObject [{0}].", identifier ); } status.Messages.Add(message); response.Append(status); } } catch (Exception ex) { _logger.ErrorFormat("Error while deleting a list of data objects of type [{0}]: {1}", objectType, ex); throw new Exception("Error while deleting a list of data objects of type [" + objectType + "].", ex); } return(response); }
public int Delete(string identifier) { int response = _widgetProvider.DeleteWidgets(Int32.Parse(identifier)); return(response); }