Пример #1
0
        public IActionResult UpdateGroup(ManageGroupViewModel viewModel)
        {
            var groupId = viewModel.UpdateGroupViewModel.Id;

            if (!CheckIfOwner(groupId, User.Identity.Name))
            {
                return RedirectToAction("Index");
            }

            var updateGroupViewModel = viewModel.UpdateGroupViewModel;

            var request = Mapper.Map<UpdateGroupRequest>(updateGroupViewModel);

            var result = _groupsService.UpdateGroup(request);

            return RedirectToAction("Manage", new { groupId = groupId });
        }
Пример #2
0
        public IActionResult Manage(int groupId)
        {
            if (!CheckIfOwner(groupId, User.Identity.Name))
            {
                return RedirectToAction("Index");
            }

            var groupResult = _groupsService.GetDataWithUsers(new GetGroupRequest { GroupId = groupId });

            var basicDataViewModel = Mapper.Map<GroupBasicDataViewModel>(groupResult.Item);
            var updateGroupViewModel = Mapper.Map<UpdateGroupViewModel>(groupResult.Item);

            var viewModel = new ManageGroupViewModel
            {
                GroupId = groupResult.Item.Id,
                BasicDataViewModel = basicDataViewModel,
                UpdateGroupViewModel = updateGroupViewModel,
                AccessType = GroupAccessTypeEnum.Owner
            };

            return View("Manage", viewModel);
        }