Exemple #1
0
        public ActionResult LotteryNumberAddNew(LotteryNumber lotteryNumber, int ticketId)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var dupNumFound = repo.CheckDuplicateTicket(ticketId, false, lotteryNumber);
                    if (dupNumFound)
                    {
                        ViewData["EditError"] = DuplicateTicketFoundMessage;
                    }
                    else
                    {
                        repo.SaveLotteryNumbers(lotteryNumber);
                    }
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }

            return(PartialView("LotteryNumberPartial", GetLotteryNumbers(ticketId)));
        }