Beispiel #1
0
        public ActionResult AddToFreeTip(FreeTipViewModel freeTipsView)
        {
            var result = Array.ConvertAll(freeTipsView.freeTip.Result.Split(':'), int.Parse).ToList();

            if (result[0] > result[1])
            {
                freeTipsView.freeTip.Tip = Convert.ToString('1');
            }
            else if (result[0] < result[1])
            {
                freeTipsView.freeTip.Tip = Convert.ToString('2');
            }
            else
            {
                freeTipsView.freeTip.Tip = Convert.ToString('X');
            }
            _context.FreeTips.Add(freeTipsView.freeTip);
            _context.SaveChanges();
            var freeTips             = _context.FreeTips.OrderByDescending(d => d.Date).ToList();
            var newViewModelFreeTips = new FreeTipViewModel
            {
                freeTips = freeTips
            };

            return(View("AddFreeTip", newViewModelFreeTips));
        }
Beispiel #2
0
        public ViewResult AddFreeTip()
        {
            var freeTips             = _context.FreeTips.OrderByDescending(d => d.Id).ToList();
            var newViewModelFreeTips = new FreeTipViewModel
            {
                freeTips = freeTips
            };

            return(View(newViewModelFreeTips));
        }
Beispiel #3
0
        public ActionResult DeleteMatch(int id)
        {
            var freeTip = _context.FreeTips.FirstOrDefault(x => x.Id == id);

            _context.FreeTips.Remove(freeTip);
            _context.SaveChanges();
            var freeTips             = _context.FreeTips.OrderByDescending(d => d.Id).ToList();
            var newViewModelFreeTips = new FreeTipViewModel
            {
                freeTips = freeTips
            };

            return(View("AddFreeTip", newViewModelFreeTips));
        }