public ActionResult Index(CustomerVoucher model, FormCollection form)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string customerName = (from e in entity.Customers where e.CustomerId == model.CustomerId select e.Name).First().ToString();
                    string mobileNumber = (from e in entity.Customers where e.CustomerId == model.CustomerId select e.MobileNo).First().ToString();
                    mobileNumber = mobileNumber.Replace("(", String.Empty);
                    mobileNumber = mobileNumber.Replace(")", String.Empty);
                    mobileNumber = mobileNumber.Replace("-", String.Empty);
                    mobileNumber = mobileNumber.Replace(" ", String.Empty);
                    string vouchername = (from e in entity.Vouchers where e.VoucherId == model.VoucherId select e.VoucherName).First().ToString();
                    string mailId      = (from e in entity.Customers where e.CustomerId == model.CustomerId select e.EmailId).First().ToString();
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        var addCustomerVoucher = new LMS_Datas.CustomerVoucher()
                        {
                            CustomerId = model.CustomerId,
                            VoucherId  = model.VoucherId,
                            AssignNo   = model.AssignNo,
                            AssignOn   = DateTime.Now,
                            Active     = true
                        };
                        context.CustomerVouchers.Add(addCustomerVoucher);

                        //context.ClientDetails.Add(clientDetails);
                        //etc add your other classes
                        context.SaveChanges();
                    }
                    ViewBag.CustomerId = new SelectList(entity.Customers.Where(models => models.Active == true), "CustomerId", "Name");
                    ViewBag.VoucherId  = new SelectList(entity.Vouchers.Where(models => models.Activate == true), "VoucherId", "VoucherName");
                    ViewBag.alert      = "Success";
                    builder.Append("Hello " + customerName + ",").AppendLine();
                    builder.Append("Voucher " + vouchername + " is assigned to you. Use Voucher No. " + model.AssignNo + " for further references.").AppendLine();
                    builder.Append("Thanks");
                    //sms.send(mobileNumber, builder);
                    sms.send("8285601519", builder);
                    Mail.send(builder, "*****@*****.**", "*****@*****.**", "Voucher Assigned");
                }
            }
            catch (Exception e1)
            {
                ViewBag.alert = "Error";
            }
            return(View());
        }
        public ActionResult Index(TransferVoucher model)
        {
            try
            {
                ViewBag.TransferTo   = new SelectList(entity.Customers.Where(models => models.Active == true), "CustomerId", "Name");
                ViewBag.TransferFrom = new SelectList(entity.Customers.Where(models => models.Active == true), "CustomerId", "Name");
                ViewBag.VoucherDd    = new SelectList(entity.Vouchers.Where(models => models.Activate == true), "VoucherId", "VoucherName");
                if (ModelState.IsValid)
                {
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        var transferVoucher = new LMS_Datas.TransferVoucher()
                        {
                            TransferFromCustomerID = model.TransferFromCustomerID,
                            TransferToCustomerID   = model.TransferToCustomerID,
                            VoucherID   = model.VoucherID,
                            TranferDate = DateTime.Now
                        };
                        context.TransferVouchers.Add(transferVoucher);
                        context.SaveChanges();
                        ViewBag.alert = "Success";
                        string TransferFrom = (from e in entity.Customers where e.CustomerId == model.TransferFromCustomerID select e.Name).First().ToString();
                        string TransferTo   = (from e in entity.Customers where e.CustomerId == model.TransferToCustomerID select e.Name).First().ToString();
                        string vouchername  = (from e in entity.Vouchers where e.VoucherId == model.VoucherID select e.VoucherName).First().ToString();
                        string voucherno    = (from e in entity.CustomerVouchers where e.VoucherId == model.VoucherID select e.AssignNo).First().ToString();
                        string mobileNumber = (from e in entity.Customers where e.CustomerId == model.TransferToCustomerID select e.MobileNo).First().ToString();
                        mobileNumber = mobileNumber.Replace(")", String.Empty);
                        mobileNumber = mobileNumber.Replace("-", String.Empty);
                        mobileNumber = mobileNumber.Replace(" ", String.Empty);
                        builder.Append("Hello " + TransferTo + ",").AppendLine();
                        builder.Append("Voucher " + vouchername + " is Transferred to you by " + TransferFrom + ". Use Voucher No. " + voucherno + " for further references.").AppendLine();

                        builder.Append("Thanks");
                        //sms.send(mobileNumber, builder);
                        sms.send("8285601519", builder);
                        Mail.send(builder, "*****@*****.**", "*****@*****.**", "Voucher Assigned");
                    }
                }
                return(View());
            }
            catch (Exception e1)
            {
                ViewBag.alert = "Error";
                return(View());
            }
        }