コード例 #1
0
        public ActionResult AddUserToRole(string userName, string roleName)
        {
            DeveloCurityBaseEntities context = new DeveloCurityBaseEntities();
            AspNetUser user = context.AspNetUsers
                                .Where(u => u.UserName == userName).FirstOrDefault();
            AspNetRole role = context.AspNetRoles
                             .Where(r => r.Name == roleName).FirstOrDefault();

            user.AspNetRoles.Add(role);
            context.SaveChanges();
            return View();
        }
コード例 #2
0
        public ActionResult PayPal()
        {
            Paypal_IPN paypalResponse = new Paypal_IPN("test");

            if (paypalResponse.TXN_ID != null)
            {
                DeveloCurityBaseEntities context = new DeveloCurityBaseEntities();
                IPN ipn = new IPN();
                ipn.transactionID = paypalResponse.TXN_ID;
                decimal amount = Convert.ToDecimal(paypalResponse.PaymentGross);
                ipn.amount = amount;
                ipn.buyerEmail = paypalResponse.PayerEmail;
                ipn.txTime = DateTime.Now;
                ipn.custom = paypalResponse.Custom;
                ipn.paymentStatus = paypalResponse.PaymentStatus;
                ipn.transactionID = paypalResponse.TXN_ID;
                ipn.firstName = paypalResponse.PayerFirstName;
                ipn.lastName = paypalResponse.PayerLastName;
                ipn.totalTickets = Convert.ToInt16(paypalResponse.Quantity);
                context.IPNs.Add(ipn);
                context.SaveChanges();
            }
            return View();

        }
コード例 #3
0
 public ActionResult AddRole(AspNetRole role)
 {
     DeveloCurityBaseEntities context = new DeveloCurityBaseEntities();
     context.AspNetRoles.Add(role);
     context.SaveChanges();
     return View();
 }