public PartialViewResult FastOrderPopup() { var model = new FastOrderModel() { Type = "Физическое лицо" }; if (HttpContext.User.Identity.IsAuthenticated) { var db = new DB(); var user = db.Users.FirstOrDefault(x => x.UserId == HttpContext.GetCurrentUserUID()); if (user != null) { model.Email = user.MembershipData.Email; model.EmailA = user.MembershipData.Email; model.OrgMail = user.MembershipData.Email; model.OrgMailB = user.MembershipData.Email; model.FullName = user.Profile.FullName; model.FullNameA = user.Profile.FullName; model.OrgPerson = user.Profile.FullName; model.OrgPersonB = user.Profile.FullName; model.Phone = user.Phone; model.PhoneA = user.Phone; model.OrgPhone = user.Phone; model.OrgPhoneB = user.Phone; } } return(PartialView(model)); }
public PartialViewResult FastOrderPopup(FastOrderModel form) { if (form.Type == "Физическое лицо") { if (form.FullName.IsNullOrEmpty() || form.Address.IsNullOrEmpty() || form.Phone.IsNullOrEmpty() || form.Email.IsNullOrEmpty()) { form.ErrorText = "Необходимо заполнить все поля, отмеченные *"; return(PartialView(form)); } } else if (form.Type == "Юридическое лицо") { if (form.OrgName.IsNullOrEmpty() || form.OrgPerson.IsNullOrEmpty() || form.OrgPhone.IsNullOrEmpty() || form.OrgMail.IsNullOrEmpty() || form.OrgINN.IsNullOrEmpty() || form.OrgKorr.IsNullOrEmpty() || form.OrgAccount.IsNullOrEmpty() || form.OrgBankName.IsNullOrEmpty() || form.OrgBik.IsNullOrEmpty() || form.OrgJurAddr.IsNullOrEmpty() || form.OrgFaktAddr.IsNullOrEmpty() || form.OrgDelivAddr.IsNullOrEmpty() || form.OrgMail.IsNullOrEmpty()) { form.ErrorText = "Необходимо заполнить все поля, отмеченные *"; return(PartialView(form)); } } else if (form.Type == "Регионы РФ:Физическое лицо") { if (form.FullNameA.IsNullOrEmpty() || form.AddressA.IsNullOrEmpty() || form.PhoneA.IsNullOrEmpty() || form.TargetFullNameA.IsNullOrEmpty() || form.TargetPassA.IsNullOrEmpty() || form.TargetAddressA.IsNullOrEmpty() || form.EmailA.IsNullOrEmpty()) { form.ErrorText = "Необходимо заполнить все поля, отмеченные *"; return(PartialView(form)); } } else { if (form.OrgNameB.IsNullOrEmpty() || form.OrgPersonB.IsNullOrEmpty() || form.OrgPhoneB.IsNullOrEmpty() || form.OrgMailB.IsNullOrEmpty() || form.OrgINNB.IsNullOrEmpty() || form.OrgKorrB.IsNullOrEmpty() || form.OrgAccountB.IsNullOrEmpty() || form.OrgBankNameB.IsNullOrEmpty() || form.OrgBikB.IsNullOrEmpty() || form.OrgJurAddrB.IsNullOrEmpty() || form.OrgFaktAddrB.IsNullOrEmpty() || form.OrgDelivAddrB.IsNullOrEmpty() || form.OrgTargetPersonB.IsNullOrEmpty() || form.OrgTargetPassB.IsNullOrEmpty() || form.OrgMailB.IsNullOrEmpty()) { form.ErrorText = "Необходимо заполнить все поля, отмеченные *"; return(PartialView(form)); } } var cart = new ShopCart().InitCart(); var order = cart.CreateOrder(form); if (order == null) { form.ErrorText = "Для оформления заказа необходимо пройти авторизацию или зарегистрироваться"; return(PartialView(form)); } cart.SendLetters(order, form); cart.Clear(); cart.Reset(); form.ErrorText = "<script type=\"text/javascript\">document.location.href = '/order?step=final'</script>"; return(PartialView(form)); }