public ActionResult Index(string Id, int Type, int NextActivity, int NextStatus)
        {
            BetDataRepository _repositoryB = new BetDataRepository();

            switch (NextActivity)
            {
            case 202:
                return(RedirectToAction("Invited", "Home", new { id = Id, type = Type }));

            case 203:
                _repositoryB.VoucherUpdateStatus(Guid.Parse(Id), NextStatus);

                //ZAPIŠEMO HISTORY!!!
                new EventData(Guid.Parse(Id), WebSecurity.GetUserId(User.Identity.Name), NextActivity).Add();
                break;

            default:
                break;
            }

            List <BetData> bets = new List <BetData>();

            bets = _repositoryB.SelectVouchers(WebSecurity.GetUserId(User.Identity.Name));

            ViewBag.ActiveLink = 0;
            return(View("Index", bets));
        }
        public ActionResult PostCreditInfo(string Id, int Type, int NextActivity, int NextStatus, HttpPostedFileBase uplFile)
        {
            BetDataRepository _repositoryB = new BetDataRepository();

            Guid tmpGuid = Guid.Parse(Id);

            _repositoryB.VoucherUpdateStatus(tmpGuid, NextStatus);

            string extension = String.Empty;

            if (uplFile != null && uplFile.ContentLength > 0)
            {
                extension = uplFile.FileName.Substring(uplFile.FileName.IndexOf(".") + 1, uplFile.FileName.Length - uplFile.FileName.IndexOf(".") - 1).ToLower();

                int tmpuserID = WebSecurity.GetUserId(User.Identity.Name);

                var fileName = tmpGuid.ToString() + "_" + tmpuserID + "." + extension;//Path.GetFileName(uplFile.FileName);
                var path     = Path.Combine(Server.MapPath("~/upload/credit-notes/"), fileName);
                uplFile.SaveAs(path);

                IFileDataRepository repositoryF = new FileDataRepository();
                FileData            file        = new FileData();
                file.BetGuid       = tmpGuid;
                file.FileTypeID    = 208; //CREDIT NOTE
                file.FileExtension = extension;
                file.FilePath      = path;
                file.InsertUserID  = tmpuserID;

                repositoryF.Insert(file);
            }

            //ZAPIŠEMO HISTORY!!!
            new EventData(Guid.Parse(Id), WebSecurity.GetUserId(User.Identity.Name), !String.IsNullOrEmpty(extension) ? 209: NextActivity).Add();

            List <BetData> bets = new List <BetData>();

            bets = _repositoryB.SelectVouchers(WebSecurity.GetUserId(User.Identity.Name));

            ViewBag.ActiveLink = 0;
            return(RedirectToAction("Index"));
        }