Ejemplo n.º 1
0
        public IActionResult CreateClub(GroupViewModel model)
        {
            if (ModelState.IsValid)
            {
                var group = _mapper.Map <GroupViewModel, Group>(model);

                group.Name = "k/" + group.Name;

                _settingRepository.CreateGroup(group);

                GroupUser groupUser = new GroupUser
                {
                    UserId  = _user.Id,
                    GroupId = group.Id,
                    RoleId  = 1
                };

                _settingRepository.AddGroupUser(groupUser);

                return(RedirectToAction("clubs"));
            }


            return(Ok(model));
        }