public static bool UpdateContest(Contest contest)
{
try
{
using (SqlConnection connection = ConnectionManager.GetConnection())
{
var data = new ActivEarthDataProvidersDataContext(connection);
ContestDataProvider dbContest =
(from c in data.ContestDataProviders where c.id == contest.ID select c).FirstOrDefault();
if (dbContest != null)
{
dbContest.name = contest.Name;
dbContest.description = contest.Description;
dbContest.reward = contest.Reward;
dbContest.end_mode = (byte)contest.Mode;
dbContest.end_goal = contest.EndValue;
dbContest.end_time = contest.EndTime;
dbContest.start = contest.StartTime;
dbContest.type = (byte)contest.Type;
dbContest.statistic = (byte)contest.StatisticBinding;
dbContest.searchable = contest.IsSearchable;
dbContest.active = contest.IsActive;
dbContest.deactivated = contest.DeactivatedTime;
dbContest.creator_id = contest.CreatorId;
data.SubmitChanges();
}
else
{
return false;
}
}
if (contest != null)
{
foreach (ContestTeam team in contest.Teams)
{
TeamDAO.UpdateTeam(team);
}
}
return true;
}
catch (Exception)
{
return false;
}
}