public override bool DeleteData(int id, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; try { using (FrameMaterialColorMngEntities context = CreateContext()) { FrameMaterialColor dbItem = context.FrameMaterialColor.FirstOrDefault(o => o.FrameMaterialColorID == id); if (dbItem == null) { notification.Message = "Frame material color not found!"; return(false); } else { context.FrameMaterialColor.Remove(dbItem); context.SaveChanges(); return(true); } } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; return(false); } }