Esempio n. 1
0
        public async Task <IActionResult> Close(ActivityActionViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.GetUserAsync(HttpContext.User);

                var userId = _userRepository.GetIdByIdentity(user.Id);

                var id       = model.Id;
                var activity = _activityRepository.Get(id);
                if (activity.Status == 1)
                {
                    var queue = new ServiceBusManager(_configuration["ServiceBusConnectionString"], _configuration["ServiceBusQueueName"]);
                    await queue.SendMessage(new QueueElement <object>
                    {
                        Type = "ActivityClose",
                        Data = new ActivityIdViewModel()
                        {
                            Id = id, IdUser = userId
                        },
                    });
                }
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public async Task <IActionResult> Close(ActivityActionViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.GetUserAsync(HttpContext.User);

                var userId = _userRepository.GetIdByIdentity(user.Id);

                var id = model.Id;
                await _eventHub.SendMessage(new QueueElement <object>
                {
                    Type = "ActivityClose",
                    Data = new ActivityIdViewModel()
                    {
                        Id = id, IdUser = userId
                    },
                });
            }
            return(RedirectToAction("Index"));
        }