Пример #1
0
        private void SendNotificationToUser(ApplicationUser user)
        {
            var notification = new Notification();

            notification.Text = "You just Reset your password";

            NotificationApplicationUser userNotification = new NotificationApplicationUser();

            userNotification.NotificationId = notification.NotificationId;
            userNotification.UserId         = user.Id;

            _repositoryManager.UserNotification.AddUserNotification(userNotification);
        }
Пример #2
0
        public void Create(Notification notification, string tenantNID, string houseOwnerNID)
        {
            _db.Notifications.Add(notification);
            _db.SaveChanges();
            var NotificationApplicationUser = new NotificationApplicationUser {
                TenantNID      = tenantNID,
                HouseOwnerNID  = houseOwnerNID,
                NotificationId = notification.Id
            };

            _db.NotificationApplicationUsers.Add(NotificationApplicationUser);
            _db.SaveChanges();
        }
Пример #3
0
        private void SendNotificationToUser(string text, string userId)
        {
            var notification = new Notification();

            notification.Text = text;

            _repositoryManager.Notification.AddNotification(notification);

            NotificationApplicationUser userNotification = new NotificationApplicationUser();

            userNotification.NotificationId = notification.NotificationId;
            userNotification.UserId         = userId;

            _repositoryManager.UserNotification.AddUserNotification(userNotification);
        }
        public void CreateByUserId(Notification notification, string userId)
        {
            _context.Notifications.Add(notification);
            _context.SaveChanges();

            //TODO: Assign notification to users

            var userNotification = new NotificationApplicationUser();

            userNotification.UserId         = userId;
            userNotification.NotificationId = notification.Id;

            _context.UserNotifications.Add(userNotification);
            _context.SaveChanges();
        }
Пример #5
0
        private void SendNotificationToUser(UserProfile userProfile, Service service, Comment comment)
        {
            Notification notification = new Notification
            {
                Text = $"{userProfile.FirstName} {userProfile.LastName} left a review on {service.BusinessName} with a {comment.rating}.0 rating",
            };

            _repositoryManager.Notification.AddNotification(notification);

            NotificationApplicationUser userNotification = new NotificationApplicationUser();

            userNotification.NotificationId = notification.NotificationId;
            userNotification.UserId         = service.User.Id;

            _repositoryManager.UserNotification.AddUserNotification(userNotification);
        }
        public void CreateByUserList(Notification notification, List <ApplicationUser> users)
        {
            _context.Notifications.Add(notification);
            _context.SaveChanges();

            //TODO: Assign notification to users

            foreach (var user in users)
            {
                var userNotification = new NotificationApplicationUser();
                userNotification.UserId         = user.Id;
                userNotification.NotificationId = notification.Id;
                _context.UserNotifications.Add(userNotification);
                _context.SaveChanges();
            }
        }
        public void CreateByGroupId(Notification notification, int groupId)
        {
            _context.Notifications.Add(notification);
            _context.SaveChanges();

            //TODO: Assign notification to users
            var notificationGroups = _notificationGroupRepository.GetNotificationGroupFromPGroupId(groupId);

            foreach (var notificationGroup in notificationGroups)
            {
                var userNotification = new NotificationApplicationUser();
                userNotification.UserId         = notificationGroup.UserId;
                userNotification.NotificationId = notification.Id;

                _context.UserNotifications.Add(userNotification);
                _context.SaveChanges();
            }
        }
Пример #8
0
        public async Task <IActionResult> Booking(BookingViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = _repositoryManager.UserProfile.GetUserProfile(model.UserId);

                if (model.ServiceId == null)
                {
                    return(NotFound());
                }

                var service = await _repositoryManager.Service.GetServiceById(model.ServiceId);

                if (service == null)
                {
                    return(NotFound());
                }

                var booking = _mapper.Map <Booking>(model);
                _repositoryManager.Booking.AddBooking(booking);

                Notification notification = new Notification();
                notification.Text = $"{model.FirstName} {model.LastName} made a request to book your service, {service.BusinessName}";

                _repositoryManager.Notification.AddNotification(notification);

                NotificationApplicationUser userNotification = new NotificationApplicationUser();
                userNotification.NotificationId = notification.NotificationId;
                userNotification.UserId         = service.User.Id;

                _repositoryManager.UserNotification.AddUserNotification(userNotification);
                await _repositoryManager.saveAsync();

                await _hubContext.Clients.All.SendAsync("displayNotification", "");

                await _emailSender.sendEmailAsync(model.Email, "Listing Successfully Booked", $"Hello {model.FirstName}, we are glad to inform you that the service {service.BusinessName}, you requested to book has been successfully booked <br/> </br> You will be contacted with further details shortly.");

                await _emailSender.sendEmailAsync(service.User.Email, $"Your service {service.BusinessName} was just successfully booked!", "Hello, <br/> find attached below the details of the user that recently just booked your service. We hope you adhere to our User Policies while dealing with Users.");

                return(RedirectToAction(nameof(Success)));
            }

            return(View(model));
        }
Пример #9
0
        public void Create(Notification notification)
        {
            _context.Notifications.Add(notification);
            _context.SaveChanges();

            foreach (var u in _context.Persons.Where(x => x.IdentityUserId != notification.UserId).ToList())
            {
                var userNotification = new NotificationApplicationUser
                {
                    NotificationId = notification.Id,
                    UserId         = u.IdentityUserId,
                    IsRead         = false
                };
                _context.UserNotifications.Add(userNotification);
                _context.SaveChanges();
            }

            _hubContext.Clients.All.SendAsync("sendToUser");
        }
Пример #10
0
        public void Create(Notification notification, int petId)
        {
            _context.Notifications.Add(notification);
            _context.SaveChanges();

            //TODO: Assign notification to users
            var watchlists = _watchlistRepository.GetWatchlistFromPetId(petId);

            foreach (var watchlist in watchlists)
            {
                var userNotification = new NotificationApplicationUser();
                userNotification.ApplicationUserId = watchlist.UserId;
                userNotification.NotificationId    = notification.Id;

                _context.UserNotifications.Add(userNotification);
                _context.SaveChanges();
            }

            _hubContext.Clients.All.InvokeAsync("displayNotification", "");
        }
        //Create Notification
        public void Create(Notification notification, int petId)
        {
            _db.Notifications.Add(notification);
            _db.SaveChanges();

            //TODO: Assign notification to users
            //Get all pet id whose status has currentle been changed
            var watchlists = _watchlistRepository.GetWatchlistFromPetId(petId);

            foreach (var watchlist in watchlists)
            {
                //Assign notification notification to all user who has change the status of there pet list
                var userNotification = new NotificationApplicationUser();
                userNotification.ApplicationUserId = watchlist.UserId;
                userNotification.NotificationId    = notification.Id;

                _db.UserNotifications.Add(userNotification);
                _db.SaveChanges();
            }
        }