예제 #1
0
        public Club AddClub(AddClubViewModel club)
        {

            var tempClub = new Club()
            {
                Name = club.Name,
                Logo = club.Logo,
                ColorTheme = club.ColorTheme,
                Background = club.Background,
                Status = club.Status,
                Established = club.Established,
                CreateAt = DateTime.Now,
                Address = new Address()
                {
                    Telephone = club.Telephone,
                    Mobile = club.Mobile,
                    Address1 = club.Address1,
                    Address2 = club.Address2,
                    Address3 = club.Address3,
                    TownCity = club.TownCity,
                    PostCode = club.PostCode,
                },
                ClubAdmin = new ClubAdmin()
                {
                    User = new User()
                    {
                        UserName = club.ClubAdminEmail,
                        Role = Role.ClubAdmin,
                        Email = club.ClubAdminEmail,
                        Password = club.ClubAdminPassword,
                        CreateAt = DateTime.Now,
                        UpdateAt = DateTime.Now,
                        LoggedAt = DateTime.Now,
                        UserDetail = new UserDetail()
                        {
                            FirstName = club.ClubAdminName,
                        }

                    }
                },
                Chairman = new Chairman()
                {
                    Name = club.Chairman,
                    Email = club.ChairmanEmail,
                    Telephone = club.ChairmanTelephone,
                },
                
            };
            var newClub =_clubRepository.Add(tempClub);
            newClub.ClubAdmin.Club = newClub;
            newClub.ClubAdmin.User.UserDetail.User = newClub.ClubAdmin.User;
            _clubRepository.Update(newClub,newClub.Id);
            return newClub;
        }
예제 #2
0
        public void UpdateClub(Club club, int id)
        {
            if (club.Id > 0)
            {

                _clubRepository.Update(club, id);
            }

        }