public ActionResult UpdateNotification(BroadcastViewModel model)
        {
            using (BroadcastService bservice = new BroadcastService())
                using (UserBroadcastService ubservice = new UserBroadcastService())
                {
                    Broadcast b = bservice.GetById(model.Id);

                    if (b == null)
                    {
                        Notify("Sorry, the requested resource could not be found. Please try again", NotificationType.Error);

                        return(PartialView("_AccessDenied"));
                    }

                    if (b.UserBroadcasts.Any(ub => ub.UserId == CurrentUser.Id))
                    {
                        int ubid = b.UserBroadcasts.FirstOrDefault(ub => ub.UserId == CurrentUser.Id).Id;

                        ubservice.Query($"DELETE FROM [dbo].[UserBroadcast] WHERE [Id]={ubid};");
                    }
                    else
                    {
                        ubservice.Create(new UserBroadcast()
                        {
                            BroadcastId = b.Id,
                            UserId      = CurrentUser.Id,
                        });
                    }

                    Notify("The selected Notification was successfully updated.", NotificationType.Success);

                    return(MyNotifications(new PagingModel(), new CustomSearchModel()));
                }
        }
        public BroadcastCustomModel MarkNotificationAsRead(int id, int userid, string apikey)
        {
            using (UserBroadcastService service = new UserBroadcastService())
            {
                UserBroadcast ub = new UserBroadcast()
                {
                    BroadcastId = id,
                    UserId      = userid
                };

                service.Create(ub);
            }

            return(new BroadcastCustomModel()
            {
                ResponseCode = 1,
                Description = "Updated successfully"
            });
        }