public ActionResult Login(LoginViewModel model) { Result result = new Result(); var kontrol = db.User.Where(w => w.email == model.Email && w.password == model.Password).FirstOrDefault(); if (kontrol != null) { int userid = kontrol.user_id; List <Claim> claims = new Authorizing(db).GetClaims(kontrol); if (null != claims) { new Authorizing(db).SignIn(claims); var identity = (ClaimsIdentity)User.Identity; List <string> rol = identity.Claims.Where(c => c.Type == ClaimTypes.Role).Select(c => c.Value).ToList(); if (rol.Contains("Admin")) { result.adres = "../Categories/Index"; } else { result.adres = "../Home/Index"; } } result.sonuc = true; } else { result.sonuc = false; result.mesaj = "Hatalı kullanıcı adı ve/vaya şifre"; } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Processes a payment for the <see cref="IInvoice"/> /// </summary> /// <param name="invoice">The invoice to be paid</param> /// <param name="args">Additional arguments required by the payment processor</param> /// <returns>A <see cref="IPaymentResult"/></returns> public virtual IPaymentResult AuthorizePayment(IInvoice invoice, ProcessorArgumentCollection args) { Mandate.ParameterNotNull(invoice, "invoice"); var operationData = new AuthorizeOperationData() { Invoice = invoice, PaymentMethod = this.PaymentMethod, ProcessorArgumentCollection = args }; Authorizing.RaiseEvent(new SaveEventArgs <AuthorizeOperationData>(operationData), this); // persist the invoice if (!invoice.HasIdentity) { GatewayProviderService.Save(invoice); } // collect the payment authorization var response = PerformAuthorizePayment(invoice, args); //((PaymentResult)response).ApproveOrderCreation = this.EnsureApproveOrderCreation(response, invoice); AuthorizeAttempted.RaiseEvent(new PaymentAttemptEventArgs <IPaymentResult>(response), this); if (!response.Payment.Success) { return(response); } AssertPaymentApplied(response, invoice); // Check configuration for override on ApproveOrderCreation if (!response.ApproveOrderCreation) { ((PaymentResult)response).ApproveOrderCreation = MerchelloConfiguration.Current.AlwaysApproveOrderCreation; } // give response return(response); }
public ActionResult Register(User detail) { string sonuc = "olumlu"; try { User cst = db.User.Where(w => (w.name == detail.name && w.surName == detail.surName) || w.email == detail.email).FirstOrDefault(); if (cst == null) { cst = new User() { name = detail.name, surName = detail.surName, phone = detail.phone, email = detail.email, userName = detail.userName, password = detail.password, rePassword = detail.rePassword }; cst.User_Roles.Add(new User_Roles { role_id = 5 }); //Kullanıcı db.User.Add(cst); db.SaveChanges(); } List <Claim> claims = new Authorizing(db).GetClaims(cst); if (null != claims) { Session["hata"] = null; new Authorizing(db).SignIn(claims); sonuc = "olumlu"; } } catch { sonuc = "olumsuz"; } return(Json(sonuc, JsonRequestBehavior.AllowGet)); }