Пример #1
0
        public ActionResult EditOuting(Outing outing)
        {
            // Remove any groups that don't have any players selected.
            outing.GroupList = outing.GroupList.Where(x => x.PlayerList.Exists(y => y.Player.PlayerID != 0)).ToList();
            try
            {
                if (outing.OutingID == 0)
                {
                    Outing.AddOuting(outing);
                }
                else
                {
                    Outing.UpdateOuting(outing);

                    // If this was a committed outing, need to mark it as uncommitted
                    // and remove all transactions.
                    if (outing.Committed)
                    {
                        Outing.Uncommit(outing.OutingID);
                    }
                }
            }
            catch (Exception ex)
            {
                TempData["CustomError"] = $"Error {(outing.OutingID == 0 ? "adding" : "updating")} Outing: {ex.Message}";
            }
            return(RedirectToAction("ViewOuting", new { outingid = outing.OutingID }));
        }
Пример #2
0
        public ActionResult ScoreOuting(Outing outing)
        {
            Outing.UpdateOutingScore(outing);

            // If this was a committed outing, need to mark it as uncommitted
            // and remove all transactions.
            if (outing.Committed)
            {
                Outing.Uncommit(outing.OutingID);
            }

            return(RedirectToAction("ViewOuting", new { outingid = outing.OutingID }));
        }