예제 #1
0
        public bool Edit(ClubEdit edit)
        {
            var isNew = edit.Id == 0;

            if (isNew)
            {
                var club = new Club()
                {
                    Name = edit.Name
                };
                _clubRepository.Add(club);
            }
            else
            {
                var club = _clubRepository.GetAll().First(c => c.Id == edit.Id);
                club.Name = edit.Name;
            }
            _clubRepository.Save();
            return(true);
        }
예제 #2
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        if (!IsValid)
        {
            return;
        }

        Club club;

        if (Submit.CommandName == CMD_UPDATE)
        {
            club = ClubRepository.FindById(DataUtility.ParseInt(QsClubId));
            PopulateClubFromControls(club);
            ClubRepository.Update(club);
        }
        else if (Submit.CommandName == CMD_INSERT)
        {
            club = new Club();
            PopulateClubFromControls(club);
            ClubRepository.Save(club);
        }
        Response.Redirect(Cancel.NavigateUrl);
    }