public List <BroadcastCustomModel> Notifications(int id, string apikey) { using (BroadcastService service = new BroadcastService()) { List <BroadcastCustomModel> resp = new List <BroadcastCustomModel>(); List <Broadcast> broadcasts = service.List(new PagingModel(), new CustomSearchModel()); if (broadcasts.NullableAny()) { foreach (Broadcast b in broadcasts.OrderByDescending(o => o.CreatedOn)) { if (b.Status == Status.Inactive.GetIntValue()) { continue; } resp.Add(new BroadcastCustomModel() { Id = b.Id, Message = b.Message, CreatedOn = b.CreatedOn, Status = b.UserBroadcasts.Any(ub => ub.UserId == id) ? 1 : 0, }); } } return(resp); } }