示例#1
0
        public async Task <IActionResult> AddAction(ActionAddDto model)
        {
            if (ModelState.IsValid)
            {
                _actionService.Save(new Action
                {
                    WorkId      = model.WorkId,
                    Description = model.Description,
                    Detail      = model.Detail,
                    TimeSpent   = model.TimeSpent
                });
                var activeUser = await GetLoggedInUser();

                var adminUserList = await _userManager.GetUsersInRoleAsync("Admin");

                var work = _workService.FindById(model.WorkId);
                foreach (var admin in adminUserList)
                {
                    _notificationService.Save(new Notification
                    {
                        Description = $"{activeUser.Name} {activeUser.SurName} kullanıcısı {work.Name} görevi için yeni bir aksiyon aldı",
                        AppUserId   = admin.Id,
                        Area        = "Admin",
                        Controller  = "WorkOrder",
                        Action      = "Details",
                        DataId      = model.WorkId
                    });
                }
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
示例#2
0
        public IActionResult UpdateWork(int id)
        {
            TempData["Active"] = TempDataInfo.Work;
            var work = _workService.FindById(id);

            ViewBag.Priorities = new SelectList(_priorityService.GetAll(), "Id", "Description", work.PriorityId);
            return(View(_mapper.Map <WorkUpdateDto>(work)));
        }
        public async Task <IActionResult> AssignUser(UserAssignDto model)
        {
            var work = _workService.FindById(model.WorkId);

            work.AppUserId = model.UserId;
            _workService.Update(work);

            var adminUser = await GetLoggedInUser();

            _notificationService.Save(new Notification
            {
                AppUserId   = model.UserId,
                Description = $"{work.Name} adlı görev için {adminUser.Name} {adminUser.SurName} tarafından görevlendirildiniz.",
                Area        = "Member",
                Controller  = "WorkOrder",
                Action      = "AddAction",
                DataId      = work.Id
            });

            return(RedirectToAction("Index"));
        }