Ejemplo n.º 1
0
        public ActionResult UserTestCert(int id, string name)
        {
            var userTest = UserTestService.GetByPK(id);
            var isEng    = true;

            var certName = EntityUtils.GetTestCertName(isEng, userTest);
            var user     = userTest.User;
            var userName = name ?? (isEng
                                ? user.EngFullName ?? Linguistics.Translite(user.LastName + " " + user.FirstName, true)
                                : user.FullName);

            return(View((string)"TestCert", (object)Tuple.New(userName, certName, userTest)));
        }
Ejemplo n.º 2
0
        public ActionResult TestCertInfo()
        {
            var user = UserService.GetByPK(User.UserID);

            if (user.EngFullName.IsEmpty())
            {
                user.EngFullName = Linguistics.Translite(user.LastName + " " + user.FirstName, true);
            }
            var userAddress = user
                              .UserAddresses.FirstOrDefault();

            if (userAddress == null)
            {
                userAddress = new UserAddress {
                    CountryID = Countries.Russian
                }
            }
            ;
            var currentOrder = OrderService.GetCurrentOrder();

            if (currentOrder == null)
            {
                return(RedirectToCart());
            }
            var isEngCert = currentOrder.OrderDetails.Any(x =>
                                                          _.List(TestCertLang.Eng, TestCertLang.RusEng).Contains(x.Params.Lang));
            var isPaper = currentOrder.OrderDetails.Any(x =>
                                                        x.Params.Type == TestCertType.Papper);
            var model = new TestCertInfoVM {
                Countries   = DictionariesService.GetCountries(),
                UserAddress = userAddress,
                User        = user,
                IsEngCert   = isEngCert,
                IsPaper     = isPaper
            };

            if (!isEngCert && !isPaper)
            {
                return(RedirectToAction(() => Contract()));
            }
            return(View(model));
        }