protected override CommandResult Delete() { // ToDo: Delete any TV_SeriesMedia records for this media if (_ctx == null) { return(CommandResult.Failed); } var serMedias = from serMed in _ctx.TV_SeriesMedia where serMed.Media_Item.id == ID select serMed; foreach (var sm in serMedias) { _ctx.DeleteObject(sm); } try { _ctx.SaveChanges(); } catch (Exception) { return(CommandResult.Failed); } return(CommandResult.Successful); }
protected override CommandResult Delete() { if (_ctx == null || _category == null) { return(CommandResult.Failed); } try { _ctx.DeleteObject(_category); _ctx.SaveChanges(); } catch (Exception) { return(CommandResult.Failed); } return(CommandResult.Successful); }
protected override CommandResult Delete() { // Delete from the DB var seg = (from segs in _ctx.Media_Segment where segs.id == ID select segs).FirstOrDefault(); if (_segment == null) { return(CommandResult.Failed); } try { _ctx.DeleteObject(seg); _ctx.SaveChanges(); } catch (Exception) { return(CommandResult.Failed); } return(CommandResult.Successful); }