コード例 #1
0
        public ActionResult Create(List <citation> citations_f, string url, string amount)
        {
            if (citations_f != null)
            {
                //create an order for citation
                order order = new order();
                int   last  = findlast() + 111;
                order.orderno   = "SZ" + last;
                order.orderdate = DateTime.Now;
                order.service   = "Zilla Local SEO";
                order.status    = status.awaiting_payment;
                order.userID    = db.users.Where(u => u.email == User.Identity.Name).FirstOrDefault().ID;
                db.orders.Add(order);
                db.SaveChanges();
                if (ModelState.IsValid)
                {
                    foreach (citation citation in citations_f)
                    {
                        citation.orderID   = findlast(); //assign last(i.e. above) order ID to citation OrderID
                        Session["orderID"] = findlast();
                        Session["amount"]  = amount;
                        db.citations.Add(citation);
                    }
                    db.SaveChanges();

                    return(Redirect(url));
                }
            }
            return(View(citations_f));
        }
コード例 #2
0
        public ActionResult Create(List <zillax> zillaxes_f, string url, string amount)
        {
            if (zillaxes_f != null)
            {
                //create an order for blog
                order order = new order();
                int   last  = findlast() + 111;
                order.orderno   = "SZ" + last;
                order.orderdate = DateTime.Now;
                order.service   = "Zilla X";
                order.status    = status.awaiting_payment;
                order.userID    = db.users.Where(u => u.email == User.Identity.Name).FirstOrDefault().ID;
                db.orders.Add(order);
                db.SaveChanges();
                if (ModelState.IsValid)
                {
                    foreach (zillax zillax in zillaxes_f)
                    {
                        zillax.orderID     = findlast(); //assign last(i.e. above) order ID to blog OrderID
                        Session["orderID"] = findlast();
                        Session["amount"]  = amount;
                        db.zillaxes.Add(zillax);
                    }
                    db.SaveChanges();
                    //return RedirectToAction("Index", "orders");
                    //return Redirect("https://amit-test.chargebee.com/hosted_pages/plans/test_plan");
                    return(Redirect(url));
                }
            }

            return(View(zillaxes_f));
        }
コード例 #3
0
        public ActionResult Create([Bind(Include = "ID,firstname,lastname,email,country,password,Roles")] user user)
        {
            if (ModelState.IsValid)
            {
                var userfound = db.users.Where(u => u.email == user.email).FirstOrDefault();
                if (userfound == null)
                {
                    db.users.Add(user);
                    db.SaveChanges();
                    dal  dl       = new dal();
                    user userauth = dl.getuser(user.email, user.password);
                    if (User.Identity.IsAuthenticated)
                    {
                        FormsAuthentication.SignOut();
                    }
                    FormsAuthentication.SetAuthCookie(userauth.email, true);
                    var    authTicket      = new FormsAuthenticationTicket(1, userauth.email, DateTime.Now, DateTime.Now.AddMinutes(20), false, userauth.Roles);
                    string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
                    var    authCookie      = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                    HttpContext.Response.Cookies.Add(authCookie);
                    return(RedirectToAction("Index", "orders"));
                }
                else
                {
                    ModelState.AddModelError("Emailexists", "This email is already taken!");
                    return(View(user));
                }
            }



            return(View(user));
        }
コード例 #4
0
        public ActionResult Create([Bind(Include = "ID,firstname,lastname,email,country,password")] user user)
        {
            if (ModelState.IsValid)
            {
                db.users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
コード例 #5
0
        public ActionResult Create([Bind(Include = "ID,orderdate,duedate,status,comment,tags,userID")] order order)
        {
            if (ModelState.IsValid)
            {
                db.orders.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.userID = new SelectList(db.users, "ID", "firstname", order.userID);
            return(View(order));
        }
コード例 #6
0
        public ActionResult Create([Bind(Include = "ID,orderdate,duedate,status,comment,tags,userID,daordered,wordcount,anchortext,targeturl,posttitle,postplacement,da")] blog blog)
        {
            if (ModelState.IsValid)
            {
                db.blogs.Add(blog);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.userID = new SelectList(db.users, "ID", "firstname", blog.userID);
            return(View(blog));
        }
コード例 #7
0
        public ActionResult Login(LoginModel log)
        {
            usercontext us = new usercontext();

            us.logins.Add(log);
            us.SaveChanges();
            return(View());
        }
コード例 #8
0
        public ActionResult Forget_Password(string email)
        {
            if (email != null)
            {
                if (ModelState.IsValid)
                {
                    user user = db.users.Where(u => u.email == email).FirstOrDefault();
                    if (user != null)//if user exist
                    {
                        string To = email, UserID, Password, SMTPPort, Host;
                        string token = Convert.ToBase64String(Guid.NewGuid().ToByteArray());
                        token             = token.Replace("=", "");
                        token             = token.Replace("[", "");
                        token             = token.Replace("+", "");
                        token             = token.Replace("]", "");
                        token             = token.Replace("/", "");
                        user.token        = token;
                        user.timeforreset = DateTime.Now.AddHours(24);
                        db.users.Attach(user);
                        db.Entry(user).Property("token").IsModified        = true;
                        db.Entry(user).Property("timeforreset").IsModified = true;
                        db.SaveChanges();

                        var lnkHref = "<a href='" + Url.Action("resetpassword", "Authentication", new { email = email, token = token }, "http") + "'>Click this link to set a new password.</a>";

                        //HTML Template for Send email

                        string subject = "Your changed password";

                        string body = "<b>We have received a request to change your password.</b><br/>" + "</br>" + lnkHref + "<br/>" + "<p>If you did not make this request then you can simply ignore this email.</p><br/><p>Thanks,<br/><br/><b>Seozilla Support</b></p>" + "<hr>" + "<img src='http://www.seozilla.co.uk/wp-content/uploads/2017/11/cropped-logo-home.png'/>" + "<br/>" + "<b>Telephone:</b> 020 3808 7777 <p><b>Website: </b>http://seozilla.co.uk/</p>" + "<br/>" + "<p style='font-size: 10px;'><b>Registered Address:</b>86-90 Paul Street,London,EC2A 4NE</p></br><p style='font-size: 10px;'><b>Disclaimer:</b> This message (and any attachments) is private and confidential and may contain personal data or personal views which are not the views of Seozilla unless specifically stated. If you have received this message in error, please notify us and remove it from your system. Do not use, copy or disclose the information in any way.</p>";


                        //Get and set the AppSettings using configuration manager.

                        emailmanager.Appsettings(out UserID, out Password, out SMTPPort, out Host);

                        //Call send email methods.

                        emailmanager.SendEmail(UserID, subject, body, To, UserID, Password, SMTPPort, Host);
                    }
                }
            }
            return(RedirectToAction("forget_password_message", "Authentication"));
        }
コード例 #9
0
        public ActionResult Create(List <blog> blogs_f, string url, string amount)
        {
            if (blogs_f != null)
            {
                //create an order for blog
                order order = new order();
                int   last  = findlast() + 111;
                order.orderno   = "SZ" + last;
                order.orderdate = DateTime.Now;
                order.service   = "Zilla Guest Post";
                order.status    = status.awaiting_payment;
                order.userID    = db.users.Where(u => u.email == User.Identity.Name).FirstOrDefault().ID;
                db.orders.Add(order);
                db.SaveChanges();
                if (ModelState.IsValid)
                {
                    foreach (blog blog in blogs_f)
                    {
                        blog.orderID       = findlast(); //assign last(i.e. above) order ID to blog OrderID
                        Session["orderID"] = findlast();
                        Session["amount"]  = amount;
                        db.blogs.Add(blog);
                    }
                    db.SaveChanges();
                    //return RedirectToAction("Index", "orders");
                    //return Redirect("https://amit-test.chargebee.com/hosted_pages/plans/test_plan");
                    return(Redirect(url));
                }
            }

            //foreach (blog blog in blogs_f)
            //{
            //    ViewData["[0].orderID"] = new SelectList(db.orders, "ID", "orderno", blog.orderID);
            //    ViewData["[1].orderID"] = new SelectList(db.orders, "ID", "orderno", blog.orderID);

            //    //ViewBag.orderID = new SelectList(db.orders, "ID", "orderno", blog.orderID);
            //    //ViewBag.orderID = new SelectList(db.orders, "ID", "orderno", blog.orderID);


            //}
            return(View(blogs_f));
        }