public ActionResult Create([Bind(Include = "id,customerId,orderDate,endDate,address,paymentMethodId,paymentStatus,amount,description,statusId,createdBy,shippingId,employeeIdConfirm,employeeIdShipping,totalDebt,totalOrder,status")]
                                   Order order)
        {
            if (ModelState.IsValid)
            {
                order.orderDate = DateTime.Now;
                if (order.paymentStatus == "done")
                {
                    order.endDate = DateTime.Now;
                }
                order.createdBy         = Session["username_Employee"].ToString();
                order.employeeIdConfirm = Int32.Parse(Session["id_Employee"].ToString());
                order.status            = true;
                db.Orders.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.customerId         = new SelectList(db.Customers, "id", "name", order.customerId);
            ViewBag.paymentMethodId    = new SelectList(db.PayMentMethods, "id", "paymentName", order.paymentMethodId);
            ViewBag.shippingId         = new SelectList(db.ShippingAdresses, "id", "addressName", order.shippingId);
            ViewBag.statusId           = new SelectList(db.Status, "id", "statusName", order.statusId);
            ViewBag.employeeIdConfirm  = new SelectList(db.Employees, "id", "email", order.employeeIdConfirm);
            ViewBag.employeeIdShipping = new SelectList(db.Employees, "id", "email", order.employeeIdShipping);
            return(View(order));
        }
Example #2
0
        public ActionResult Create([Bind(Include = "id,email,password,fullname,phone,gender,dayOfBirth,address,avatar,idCounty,activated,status,createdDate,modifyDate,modifyBy,roleId")] Customer customer,
                                   HttpPostedFileBase avatar)
        {
            if (ModelState.IsValid)
            {
                string path = Server.MapPath("/Assets/Admin/resources/customer");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                if (customer.avatar != null)
                {
                    avatar.SaveAs(path + "/" + avatar.FileName);
                    customer.avatar = "Assets/Admin/resources/customer/" + avatar.FileName;
                }
                else
                {
                    customer.avatar = "Assets/Admin/resources/customer/" + "customerDefault.jpg";
                }

                customer.createdDate = DateTime.Now;
                customer.password    = EncryptPassword.EncryptForPassword(customer.password);
                db.Customers.Add(customer);
                db.SaveChanges();
                return(new RedirectResult(url: "/Admin/Customers/Index?message=insert_success"));
            }

            ViewBag.idCounty = new SelectList(db.Counties, "id", "name", customer.idCounty);
            ViewBag.roleId   = new SelectList(db.Roles, "id", "name", customer.roleId);
            return(View(customer));
        }
Example #3
0
        public ActionResult Create([Bind(Include = "id,addressName,price")] ShippingAdress shippingAdress)
        {
            if (ModelState.IsValid)
            {
                db.ShippingAdresses.Add(shippingAdress);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(shippingAdress));
        }
Example #4
0
        public ActionResult Create([Bind(Include = "id,providerName,phone,address,email,status")] Provider provider)
        {
            if (ModelState.IsValid)
            {
                db.Providers.Add(provider);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(provider));
        }
        public ActionResult Create([Bind(Include = "id,statusName,color")] Status status)
        {
            if (ModelState.IsValid)
            {
                db.Status.Add(status);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(status));
        }
        public ActionResult Create([Bind(Include = "id,paymentName")] PayMentMethod payMentMethod)
        {
            if (ModelState.IsValid)
            {
                db.PayMentMethods.Add(payMentMethod);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(payMentMethod));
        }
        public ActionResult Create([Bind(Include = "id,name")] Role role)
        {
            if (ModelState.IsValid)
            {
                db.Roles.Add(role);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(role));
        }
        public ActionResult Create([Bind(Include = "id,name")] County county)
        {
            if (ModelState.IsValid)
            {
                db.Counties.Add(county);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(county));
        }
        public ActionResult Create([Bind(Include = "id,workerName,phone,address,gender,dayOfBirth,avatar,status,dateStart,dateEnd,contactSalary,unitSalary,workTime,schedule")] Worker worker)
        {
            if (ModelState.IsValid)
            {
                db.Workers.Add(worker);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(worker));
        }
        public ActionResult Create([Bind(Include = "id,categoryName,categoryCode,description,createdDate,createdBy,modifyDate,modifyBy,status")] Category category)
        {
            if (ModelState.IsValid)
            {
                db.Categories.Add(category);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
Example #11
0
        public ActionResult Create([Bind(Include = "id,workerId,dateStart,dateEnd,title,status")] Work work)
        {
            if (ModelState.IsValid)
            {
                db.Works.Add(work);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.workerId = new SelectList(db.Workers, "id", "workerName", work.workerId);
            return(View(work));
        }
        public ActionResult Create([Bind(Include = "id,orderId,codeName,createdDate,createdBy")] Barcode barcode)
        {
            if (ModelState.IsValid)
            {
                db.Barcodes.Add(barcode);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.orderId = new SelectList(db.Orders, "id", "address", barcode.orderId);
            return(View(barcode));
        }
Example #13
0
        public ActionResult Create([Bind(Include = "id,title,thumbnail,shortDescription,content,categoryPostId,createdDate,createdBy,modifyDate,modifyBy,status")] News news)
        {
            if (ModelState.IsValid)
            {
                db.News.Add(news);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.categoryPostId = new SelectList(db.PostCategories, "id", "categoryNamePost", news.categoryPostId);
            return(View(news));
        }
        public ActionResult Create([Bind(Include = "id,productName,categoryId,description,image,viewCount,discount,createdDate,createdBy,modifyDate,modifyBy,pieceType,pricePiece,kgType,priceKg,status")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.categoryId = new SelectList(db.Categories, "id", "categoryName", product.categoryId);
            return(View(product));
        }
        public ActionResult Create([Bind(Include = "id,month,employeeId,dayOff,dayWork,hourOfDay,salaryToMonth,unitSalary,fromDate,toDate,standardWorkDay,totalWorkDay,baseSalary,mainSalary,subsidySalary,totalOverTime,overtimePay,totalSalary,description")] PayRollsEmployee payRollsEmployee)
        {
            if (ModelState.IsValid)
            {
                db.PayRollsEmployees.Add(payRollsEmployee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.employeeId = new SelectList(db.Employees, "id", "email", payRollsEmployee.employeeId);
            return(View(payRollsEmployee));
        }
Example #16
0
        public ActionResult Create([Bind(Include = "id,employeeId,roleId")] AccountRole accountRole)
        {
            if (ModelState.IsValid)
            {
                db.AccountRoles.Add(accountRole);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.employeeId = new SelectList(db.Employees, "id", "email", accountRole.employeeId);
            ViewBag.roleId     = new SelectList(db.Roles, "id", "name", accountRole.roleId);
            return(View(accountRole));
        }
        public ActionResult Create([Bind(Include = "id,categoryName,categoryCode,description,createdDate,createdBy,modifyDate,modifyBy,status")] Category category)
        {
            if (ModelState.IsValid)
            {
                category.createdDate = DateTime.Now;
                category.createdBy   = Session["username"].ToString();
                db.Categories.Add(category);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
Example #18
0
        public ActionResult Create([Bind(Include = "id,content,customerId,newId,createdDate,createdBy,modifyDate,modifyBy,status")] Comment comment)
        {
            if (ModelState.IsValid)
            {
                db.Comments.Add(comment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.customerId = new SelectList(db.Customers, "id", "email", comment.customerId);
            ViewBag.newId      = new SelectList(db.News, "id", "title", comment.newId);
            return(View(comment));
        }
Example #19
0
        public ActionResult Create([Bind(Include = "id,orderId,productId,discount,price,type,status")] OrderDetail orderDetail)
        {
            if (ModelState.IsValid)
            {
                db.OrderDetails.Add(orderDetail);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.orderId   = new SelectList(db.Orders, "id", "address", orderDetail.orderId);
            ViewBag.productId = new SelectList(db.Products, "id", "productName", orderDetail.productId);
            return(View(orderDetail));
        }
        public ActionResult Create([Bind(Include = "id,customerId,orderId,totalDebt,fromDate,toDate,description,status")] DuePayment duePayment)
        {
            if (ModelState.IsValid)
            {
                db.DuePayments.Add(duePayment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.customerId = new SelectList(db.Customers, "id", "email", duePayment.customerId);
            ViewBag.orderId    = new SelectList(db.Orders, "id", "address", duePayment.orderId);
            return(View(duePayment));
        }
Example #21
0
        public ActionResult Create([Bind(Include = "id,providerId,price,amount,description,createdDate,createdBy,modifyDate,modifyBy,available,materialName")] Material material)
        {
            if (ModelState.IsValid)
            {
                material.createdDate = DateTime.Now;
                material.createdBy   = Session["username"].ToString();
                db.Materials.Add(material);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.providerId = new SelectList(db.Providers, "id", "providerName", material.providerId);
            return(View(material));
        }
        public ActionResult Create([Bind(Include = "id,email,password,fullname,phone,gender,dayOfBirth,address,avatar,dateStart,dateEnd,contractSalary,unitSalary,workTime,schedule,createdDate,createdBy,modifyDate,modifyBy,status,activated")] Employee employee,
                                   HttpPostedFileBase avatar, string role)
        {
            if (ModelState.IsValid)
            {
                var checkEmail = db.Employees.Where(x => x.email.Equals(employee.email)).FirstOrDefault();
                if (checkEmail == null)
                {
                    string path = Server.MapPath("/Assets/Admin/resources/image");
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    if (employee.avatar != null)
                    {
                        avatar.SaveAs(path + "/" + avatar.FileName);
                        employee.avatar = "Assets/Admin/resources/image/" + avatar.FileName;
                    }
                    else
                    {
                        employee.avatar = "Assets/Admin/resources/image/" + "userDefault.jpg";
                    }
                    AccountRole account = new AccountRole();
                    account.employeeId   = employee.id;
                    account.roleId       = Convert.ToInt32(role);
                    employee.createdDate = DateTime.Now;
                    employee.dateEnd     = DateTime.Now.AddYears(1);
                    employee.createdBy   = Session["username_Employee"].ToString();
                    employee.status      = true;
                    employee.activated   = false;
                    employee.password    = EncryptPassword.EncryptForPassword(employee.password);

                    db.AccountRoles.Add(account);
                    db.Employees.Add(employee);
                    db.SaveChanges();

                    SendEmail.SendMail("Gửi từ Laundry Store, Xác nhận người dùng ! ", employee.email, " Bạn vừa đăng kí thành công tài khoản tại Laundry Store !" +
                                       " Với tên đăng nhập : " + employee.email +
                                       " Để kích hoạt tài khoản vừa đăng kí, vui lòng xác nhận tại đường dẫn tại đây: " + "https://localhost:44335/Admin/Employees/ActiveEmail?username="******"/Admin/Employees/Index?message=confirm_email"));
                }
                else
                {
                    return(new RedirectResult(url: "/Admin/Employees/Index?message=email_exists"));
                }
            }
            return(View(employee));
        }
Example #23
0
        public ActionResult EditProfile([Bind(Include = "id,email,password,fullname,phone,gender,dayOfBirth,address,avatar,idCounty,activated,status,createdDate,modifyDate,modifyBy,roleId")] Customer customer,
                                        HttpPostedFileBase avatar)
        {
            LAUNDRY_PROJECTEntities db = new LAUNDRY_PROJECTEntities();

            if (ModelState.IsValid)
            {
                string path = Server.MapPath("/Assets/Client/resources/image");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                if (customer.avatar != null)
                {
                    avatar.SaveAs(path + "/" + avatar.FileName);
                    customer.avatar = "Assets/Client/resources/image/" + avatar.FileName;
                }
                else
                {
                    customer.avatar = "Assets/Client/resources/image/" + "customerDefault.jpg";
                }

                customer.modifyDate      = DateTime.Now;
                customer.modifyBy        = Session["username_Customer"].ToString();
                db.Entry(customer).State = EntityState.Modified;
                db.SaveChanges();
                return(new RedirectResult(url: "/Account/infoProfile/" + customer.id + "?message=update_success"));
            }
            ViewBag.idCounty = new SelectList(db.Counties, "id", "name", customer.idCounty);
            return(View(customer));
        }
        public ActionResult EditProfile([Bind(Include = "id,email,password,fullname,phone,gender,dayOfBirth,address,avatar,dateStart,dateEnd,contractSalary,unitSalary,workTime,schedule,createdDate,createdBy,modifyDate,modifyBy,status,activated")] Employee employee,
                                        HttpPostedFileBase avatar, string roleEmployee)
        {
            LAUNDRY_PROJECTEntities db = new LAUNDRY_PROJECTEntities();

            if (ModelState.IsValid)
            {
                string path = Server.MapPath("/Assets/Admin/resources/image");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                if (employee.avatar != null)
                {
                    avatar.SaveAs(path + "/" + avatar.FileName);
                    employee.avatar = "Assets/Admin/resources/image/" + avatar.FileName;
                }
                else
                {
                    employee.avatar = "Assets/Admin/resources/image/" + "userDefault.jpg";
                }

                AccountRole account = new AccountRole();
                account.employeeId  = employee.id;
                account.roleId      = Int32.Parse(roleEmployee);
                employee.modifyDate = DateTime.Now;
                employee.modifyBy   = Session["username_Employee"].ToString();
                long idEmployee = employee.id;
                db.AccountRoles.Add(account);
                db.Entry(employee).State = EntityState.Modified;
                db.SaveChanges();
                return(new RedirectResult(url: "/Admin/Account/infoProfile/" + idEmployee + "?message=update_success"));
            }
            return(View(employee));
        }
        public JsonResult changePassword(long id, string newPass)
        {
            LAUNDRY_PROJECTEntities db = new LAUNDRY_PROJECTEntities();
            Employee employee          = db.Employees.Where(x => x.id == id).FirstOrDefault();

            employee.password = EncryptPassword.EncryptForPassword(newPass);
            db.SaveChanges();
            return(Json(1, JsonRequestBehavior.AllowGet));
        }
Example #26
0
        // nhận xác nhân email
        public ActionResult ActiveEmail(string username)
        {
            LAUNDRY_PROJECTEntities db = new LAUNDRY_PROJECTEntities();
            Customer customer          = db.Customers.Where(c => c.email.Equals(username)).SingleOrDefault();

            if (customer != null)
            {
                customer.activated = true;
                db.SaveChanges();
                return(new RedirectResult(url: "/Account/Login?message=insert_success"));
            }
            return(View(customer));
        }
        public ActionResult Create([Bind(Include = "id,productName,categoryId,description,image,viewCount,discount,createdDate,createdBy,modifyDate,modifyBy,type,price,status")] Product product,
                                   HttpPostedFileBase image, string pakageType, int priceKg, int pricePackage)
        {
            if (ModelState.IsValid)
            {
                string path = Server.MapPath("/Assets/Admin/resources/product");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                if (product.image != null)
                {
                    image.SaveAs(path + "/" + image.FileName);
                    product.image = "Assets/Admin/resources/product/" + image.FileName;
                }
                else
                {
                    product.image = "Assets/Admin/resources/product/" + "defaultProduct.jpg";
                }

                product.createdDate = DateTime.Now;
                product.createdBy   = Session["username_Employee"].ToString();
                product.type        = "kg";
                product.status      = true;
                product.price       = priceKg;
                db.Products.Add(product);
                db.SaveChanges();

                product.type  = pakageType;
                product.price = pricePackage;
                db.Products.Add(product);
                db.SaveChanges();
                return(new RedirectResult(url: "/Admin/Products/Index?message=insert_success"));
            }

            ViewBag.categoryId = new SelectList(db.Categories, "id", "categoryName", product.categoryId);
            return(View(product));
        }
Example #28
0
        public ActionResult RegisterAccount(FormCollection form)
        {
            LAUNDRY_PROJECTEntities db = new LAUNDRY_PROJECTEntities();
            string email           = Request.Form["email"];
            string password        = Request.Form["password"];
            string confirmPassword = Request.Form["confirmPassword"];

            var checkEmail = db.Customers.Where(c => c.email.Equals(email)).FirstOrDefault();

            if (checkEmail != null)
            {
                return(new RedirectResult(url: "/Account/RegisterAccount?message=email_exists"));
            }
            else
            {
                if (!password.Equals(confirmPassword))
                {
                    return(new RedirectResult(url: "/Account/RegisterAccount?message=invalid_password"));
                }
                else
                {
                    Customer customer = new Customer();
                    customer.email       = email;
                    customer.password    = EncryptPassword.EncryptForPassword(password);
                    customer.fullname    = "";
                    customer.address     = "";
                    customer.idCounty    = 1;
                    customer.avatar      = "Assets/Client/resources/image/" + "customerDefault.jpg";
                    customer.activated   = false;
                    customer.status      = true;
                    customer.createdDate = DateTime.Now;
                    customer.modifyDate  = DateTime.Now;
                    customer.dayOfBirth  = DateTime.Now;
                    customer.modifyBy    = "";
                    customer.roleId      = 3;

                    db.Customers.Add(customer);
                    db.SaveChanges();

                    SendEmail.SendMail("Gửi từ Laundry Store, Xác nhận người dùng ! ", customer.email, " Bạn vừa đăng kí thành công tài khoản tại Laundry Store !" +
                                       " Với tên đăng nhập : " + customer.email +
                                       " Để kích hoạt tài khoản vừa đăng kí, vui lòng xác nhận tại đường dẫn tại đây: " + "https://localhost:44335/Account/ActiveEmail/?username="******"/Account/RegisterAccount?message=confirm_email"));
                }
            }
        }
Example #29
0
        public ActionResult CreateMessage(FormCollection form)
        {
            string name            = Request.Form["name"];
            string email           = Request.Form["email"];
            string message         = Request.Form["message"];
            string idPost          = Request.Form["idPost"];
            string passwordDefault = "laundry1234";

            //khach hang khong dang nhap. tao tai khoan cho khach hang nhu email va ten ma khach hang nhap vao
            Customer customer = new Customer();

            if (Session["id_Customer"] == null)
            {
                var account = db.Customers.Where(x => x.email.Equals(email)).FirstOrDefault();
                if (account != null)
                {
                    return(new RedirectResult(url: "/Blogs/Details/" + idPost + "?message=invalid_email"));
                }
                customer.email       = email;
                customer.password    = EncryptPassword.EncryptForPassword(passwordDefault);
                customer.fullname    = name;
                customer.address     = "";
                customer.idCounty    = 1;
                customer.avatar      = "Assets/Client/resources/image/" + "customerDefault.jpg";
                customer.activated   = true;
                customer.status      = true;
                customer.createdDate = DateTime.Now;
                customer.modifyDate  = DateTime.Now;
                customer.modifyBy    = name;
                customer.dayOfBirth  = DateTime.Now;
                customer.roleId      = 3;

                db.Customers.Add(customer);
                db.SaveChanges();

                string password = EncryptPassword.DecryptPassword(customer.password);

                SendEmail.SendMail("Gửi từ Laundry Store, Xác nhận người dùng ! ", customer.email, " Bạn vừa đăng kí thành công tài khoản tại Laundry Store !" +
                                   " Với tên đăng nhập : " + customer.email +
                                   " Bạn có thể sử dụng email trên để đăng nhập vào cửa hàng của chúng tôi với mật khẩu mặc định là : " + password + " " +
                                   " Vui lòng truy cập vào đường dẫn dưới đây để cập nhật thông tin tài khoản " + "https://localhost:44335/Account/infoProfile/" + customer.id);
            }
            //khach hang co dang nhap tai khoan
            else
            {
                var customerId = int.Parse(Session["id_Customer"].ToString());
                customer = db.Customers.Find(customerId);
                if (customer != null)
                {
                    customer.email      = Session["email_Customer"].ToString();
                    customer.fullname   = Session["username_Customer"].ToString();
                    customer.modifyDate = DateTime.Now;
                    customer.modifyBy   = Session["username_Customer"].ToString();
                    db.SaveChanges();
                }
            }

            Comment comment = new Comment();

            comment.content     = message;
            comment.customerId  = customer.id;
            comment.newId       = Convert.ToInt32(idPost);
            comment.createdDate = DateTime.Now;
            comment.createdBy   = customer.fullname;
            comment.modifyDate  = DateTime.Now;
            comment.modifyBy    = customer.fullname;
            comment.status      = true;
            db.Comments.Add(comment);
            db.SaveChanges();
            return(new RedirectResult(url: "/Blogs/Details/" + idPost + "?message=comment"));
        }
        public ActionResult Contact(FormCollection form)
        {
            string first_name = Request.Form["first_name"];
            string last_name  = Request.Form["last_name"];
            string fullname   = null;

            if (first_name != null && last_name != null)
            {
                fullname = first_name + last_name;
            }
            string email       = Request.Form["email"];
            string phone       = Request.Form["phone"];
            string service     = Request.Form["service"];
            string description = Request.Form["description"];

            //khach hang khong dang nhap. tao tai khoan cho khach hang nhu email va ten ma khach hang nhap vao
            //mat khau tao mac dinh la sdt cua khach hang dang nhap vao va minh tu kich hoat tai khoan cho no luon
            Customer customer = new Customer();

            if (Session["id_Customer"] == null)
            {
                var account = db.Customers.Where(x => x.email.Equals(email)).FirstOrDefault();
                if (account != null)
                {
                    return(new RedirectResult(url: "/Home/Contact?message=invalid_email"));
                }
                customer.email       = email;
                customer.password    = EncryptPassword.EncryptForPassword(phone);
                customer.fullname    = fullname.ToString();
                customer.phone       = Convert.ToInt32(phone);
                customer.address     = "";
                customer.idCounty    = 1;
                customer.avatar      = "Assets/Client/resources/image/" + "customerDefault.jpg";
                customer.activated   = true;
                customer.status      = true;
                customer.createdDate = DateTime.Now;
                customer.modifyDate  = DateTime.Now;
                customer.modifyBy    = fullname.ToString();
                customer.dayOfBirth  = DateTime.Now;
                customer.roleId      = 3;

                db.Customers.Add(customer);
                db.SaveChanges();

                SendEmail.SendMail("Gửi từ Laundry Store, Xác nhận người dùng ! ", customer.email, " Bạn vừa đăng kí thành công tài khoản tại Laundry Store !" +
                                   " Với tên đăng nhập : " + customer.email +
                                   " Bạn có thể sử dụng email trên để đăng nhập vào cửa hàng của chúng tôi với mật khẩu là số điện thoại của bạn : " + customer.phone + " " +
                                   " Vui lòng truy cập vào đường dẫn dưới đây để cập nhật thông tin tài khoản " + "https://localhost:44335/Account/infoProfile/" + customer.id);
            }
            //khach hang co dang nhap tai khoan
            else
            {
                var customerId = int.Parse(Session["id_Customer"].ToString());
                customer = db.Customers.Find(customerId);
                if (customer != null)
                {
                    customer.email      = Session["email_Customer"].ToString();
                    customer.fullname   = Session["username_Customer"].ToString();
                    customer.modifyDate = DateTime.Now;
                    customer.modifyBy   = Session["username_Customer"].ToString();
                    db.SaveChanges();
                }
            }

            Order order = new Order();

            order.customerId    = customer.id;
            order.orderDate     = DateTime.Now;
            order.paymentStatus = "doing";
            order.description   = description;
            order.statusId      = 2;
            order.createdBy     = customer.fullname;
            order.status        = true;
            db.Orders.Add(order);
            db.SaveChanges();

            //insert table barcodes
            Barcode barcode = new Barcode();

            barcode.orderId     = order.id;
            barcode.codeName    = RandomBarCodes.RandomBarCode();
            barcode.createdDate = DateTime.Now;
            barcode.createdBy   = fullname.ToString();
            db.Barcodes.Add(barcode);
            db.SaveChanges();

            OrderDetail orderDetail = new OrderDetail();

            orderDetail.orderId   = order.id;
            orderDetail.productId = Convert.ToInt32(service);
            orderDetail.status    = true;

            db.OrderDetails.Add(orderDetail);
            db.SaveChanges();
            return(new RedirectResult(url: "/Home/Contact?message=contactSuccess"));
        }