public string EditCustomerVoucher(CustomerVoucher Model, FormCollection form)
        {
            string statusDDLValue = form["VoucherName"].ToString();
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedCustomerVoucherValue = new LMS_Datas.CustomerVoucher
                    {
                        Active     = true,
                        CustomerId = Model.CustomerId,
                        VoucherId  = Model.VoucherId,
                        AssignNo   = Model.AssignNo
                    };

                    entity.CustomerVouchers.Attach(enditedCustomerVoucherValue);

                    entity.Entry(enditedCustomerVoucherValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
        public string EditDiscount(Discountper Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedDiscountValue = new LMS_Datas.Discountper
                    {
                        DiscountRate  = Model.DiscountRate,
                        Persons       = Model.Persons,
                        Activate      = true,
                        DiscountPerId = Model.DiscountPerId
                    };

                    entity.Discountpers.Attach(enditedDiscountValue);
                    entity.Entry(enditedDiscountValue).Property(x => x.DiscountPerId).IsModified = true;
                    entity.Entry(enditedDiscountValue).Property(x => x.Activate).IsModified      = true;
                    entity.Entry(enditedDiscountValue).Property(x => x.Persons).IsModified       = true;
                    entity.Entry(enditedDiscountValue).Property(x => x.DiscountRate).IsModified  = true;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
Exemplo n.º 3
0
        public string EditCustomer(CustomerViewModel Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedCustomerValue = new LMS_Datas.Customer
                    {
                        Active     = true,
                        CustomerId = Model.CustomerId,
                        Address    = Model.Address,
                        EmailId    = Model.EmailId,
                        dob        = Model.dob,
                        Name       = Model.CustomerName,
                        MobileNo   = Model.MobileNo
                    };

                    entity.Customers.Attach(enditedCustomerValue);
                    entity.Entry(enditedCustomerValue).Property(x => x.cityId).IsModified    = false;
                    entity.Entry(enditedCustomerValue).Property(x => x.stateId).IsModified   = false;
                    entity.Entry(enditedCustomerValue).Property(x => x.dob).IsModified       = false;
                    entity.Entry(enditedCustomerValue).Property(x => x.gender).IsModified    = false;
                    entity.Entry(enditedCustomerValue).Property(x => x.countryId).IsModified = false;
                    entity.Entry(enditedCustomerValue).Property(x => x.Name).IsModified      = true;
                    entity.Entry(enditedCustomerValue).Property(x => x.EmailId).IsModified   = true;
                    entity.Entry(enditedCustomerValue).Property(x => x.MobileNo).IsModified  = true;
                    //entity.Entry(enditedValue).State = EntityState.Modified;
                    entity.SaveChanges();

                    int?loginid = (from loginId in entity.Logins where loginId.UserId == Model.CustomerId select loginId.UserId).FirstOrDefault();
                    var enditedCustomerLoginValue = new LMS_Datas.Login
                    {
                        UserId   = Model.CustomerId,
                        UserName = Model.UserName,
                        Password = Model.Password,
                        Activate = "true",
                        Role     = "Customer"
                    };

                    entity.Logins.Attach(enditedCustomerLoginValue);
                    entity.Entry(enditedCustomerLoginValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
Exemplo n.º 4
0
 public ActionResult Index(CustomerViewModel model, FormCollection form, HttpPostedFileBase files)
 {
     try
     {
         if (ModelState.IsValid)
         {
             string statusDDLValue = form["Statusddl"].ToString();
             string genderDDLValue = form["genderddl"].ToString();
             using (var context = new LoyaltyManagementSystemEntities())
             {
                 var customer = new LMS_Datas.Customer()
                 {
                     Name      = model.CustomerName,
                     Address   = model.Address,
                     dob       = model.dob,
                     EmailId   = model.EmailId,
                     MobileNo  = model.MobileNo,
                     gender    = genderDDLValue,
                     countryId = model.countryId,
                     stateId   = model.stateId,
                     cityId    = model.cityId,
                     Active    = Boolean.Parse(statusDDLValue)
                 };
                 context.Customers.Add(customer);
                 context.SaveChanges();
                 customer.CustomerId = customer.CustomerId;
                 var CustomerLogin = new LMS_Datas.Login()
                 {
                     UserId   = customer.CustomerId,
                     UserName = model.UserName,
                     Password = model.Password,
                     Activate = "true",
                     Role     = "Customer"
                 };
                 context.Logins.Add(CustomerLogin);
                 context.SaveChanges();
                 if (files.FileName != null)
                 {
                     var    ext    = Path.GetExtension(files.FileName);
                     string myfile = customer.CustomerId + ext;
                     var    path   = Path.Combine(Server.MapPath("~/Images/CustomerProfile"), myfile);
                     files.SaveAs(path);
                 }
             }
         }
         ViewBag.CountryDd = new SelectList(entity.countries.Where(models => models.Active == true), "countryId", "countryName");
         ViewBag.alert     = "Success";
         return(View());
     }
     catch (Exception e1)
     {
         ViewBag.CountryDd = new SelectList(entity.countries.Where(models => models.Active == true), "countryId", "countryName");
         ViewBag.alert     = "Error";
         return(View());
     }
 }
Exemplo n.º 5
0
        public string EditClient(LMS_Datas.Desk Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedDeskValue = new LMS_Datas.Desk
                    {
                        Active   = true,
                        AdminId  = Model.AdminId,
                        DeskName = Model.DeskName,
                        UserName = Model.UserName,
                        Password = Model.Password
                    };

                    entity.Desks.Attach(enditedDeskValue);
                    //entity.Entry(enditedDeskValue).Property(x => x.cityId).IsModified = false;
                    //entity.Entry(enditedDeskValue).Property(x => x.stateId).IsModified = false;
                    //entity.Entry(enditedDeskValue).Property(x => x.dob).IsModified = false;
                    //entity.Entry(enditedDeskValue).Property(x => x.gender).IsModified = false;
                    //entity.Entry(enditedDeskValue).Property(x => x.countryId).IsModified = false;
                    //entity.Entry(enditedDeskValue).Property(x => x.Name).IsModified = true;
                    //entity.Entry(enditedDeskValue).Property(x => x.EmailId).IsModified = true;
                    //entity.Entry(enditedDeskValue).Property(x => x.MobileNo).IsModified = true;
                    //entity.Entry(enditedValue).State = EntityState.Modified;
                    entity.SaveChanges();

                    int?loginid = (from loginId in entity.Logins where loginId.UserId == Model.AdminId select loginId.UserId).FirstOrDefault();
                    var enditedAdminLoginValue = new Login
                    {
                        UserName = Model.UserName,
                        Password = Model.Password,
                        UserId   = loginid,
                        Activate = "true"
                    };

                    entity.Logins.Attach(enditedAdminLoginValue);
                    entity.Entry(enditedAdminLoginValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
Exemplo n.º 6
0
        public ActionResult Index(Point model, FormCollection form)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string statusDDLValue = form["Statusddl"].ToString();

                    //var clientId= entity.InsertUpdateSelectAdmin(0, model.name, model.Address, model.MobileNo, model.EmailId, genderDDLValue, model.dob, model.countryId, model.stateId, model.cityId, 1, );
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        var points = new LMS_Datas.Point()
                        {
                            Points = model.Points,
                            Amount = model.Amount,
                            Active = Boolean.Parse(statusDDLValue)
                        };
                        context.Points.Add(points);

                        //context.ClientDetails.Add(clientDetails);
                        //etc add your other classes
                        context.SaveChanges();
                    }
                    ViewBag.alert = "Success";
                    return(View());
                }
                ViewBag.alert = "Error";
                return(View(model));
            }
            catch (Exception e1)
            {
                ViewBag.alert = "Error";
                return(View());
            }
        }
        public string EditPayment(PayMode Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedPaymentValue = new LMS_Datas.PayMode
                    {
                        Active    = true,
                        PayModeId = Model.PayModeId,
                        PayMode1  = Model.PayMode1
                    };

                    entity.PayModes.Attach(enditedPaymentValue);
                    entity.Entry(enditedPaymentValue).Property(x => x.PayMode1).IsModified = true;
                    entity.Entry(enditedPaymentValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
 public ActionResult Index(PayMode model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (var context = new LoyaltyManagementSystemEntities())
             {
                 var payMode = new LMS_Datas.PayMode()
                 {
                     PayMode1 = model.PayMode1,
                     Active   = true
                 };
                 context.PayModes.Add(payMode);
                 context.SaveChanges();
             }
         }
         ViewBag.alert = "Success";
         return(View());
     }
     catch (Exception e1)
     {
         ViewBag.alert = "Error";
         return(View());
     }
 }
 public ActionResult Index(Card1 model, FormCollection form)
 {
     try
     {
         ViewBag.Packages = new SelectList(entity.Packages.Where(models => models.Active == true), "PackagesId", "PackageName");
         string statusDDLValue  = form["Statusddl"].ToString();
         string packageDDLValue = form["PackagesId"].ToString();
         if (ModelState.IsValid)
         {
             using (var context = new LoyaltyManagementSystemEntities())
             {
                 var addCard = new LMS_Datas.Card1()
                 {
                     CardName    = model.CardName,
                     persons     = model.persons,
                     discountPer = model.discountPer,
                     ValidFrom   = model.ValidFrom,
                     ValidTo     = model.ValidTo,
                     Activate    = Boolean.Parse(statusDDLValue),
                     PackagesId  = Convert.ToInt32(packageDDLValue)
                 };
                 context.Card1.Add(addCard);
                 context.SaveChanges();
                 ViewBag.alert = "Success";
             }
         }
         return(View());
     }
     catch (Exception e1)
     {
         ViewBag.alert = "Error";
         return(View());
     }
 }
 public ActionResult Index(Discountper model, FormCollection form)
 {
     try
     {
         if (ModelState.IsValid)
         {
             string statusDDLValue = form["Statusddl"].ToString();
             //var clientId= entity.InsertUpdateSelectAdmin(0, model.name, model.Address, model.MobileNo, model.EmailId, genderDDLValue, model.dob, model.countryId, model.stateId, model.cityId, 1, );
             using (var context = new LoyaltyManagementSystemEntities())
             {
                 var discountper = new LMS_Datas.Discountper()
                 {
                     Persons      = model.Persons,
                     DiscountRate = model.DiscountRate,
                     Activate     = Boolean.Parse(statusDDLValue)
                 };
                 context.Discountpers.Add(discountper);
                 context.SaveChanges();
             }
             ViewBag.alert = "Success";
             return(View());
         }
         ViewBag.alert = "Error";
         return(View(model));
     }
     catch (Exception e1)
     {
         ViewBag.alert = "Error";
         return(View());
     }
 }
Exemplo n.º 11
0
        public string EditCustomerCard(CustomerCard Model, FormCollection form)
        {
            string CustomerName = form["CustomerName"].ToString();
            string CardName     = form["CardName"].ToString();
            string referenceNo  = form["ReferenceNo"].ToString();
            int    id           = Convert.ToInt16(form["id"].ToString());
            int    customerId   = (from customer in entity.Customers where customer.Name == CustomerName select customer.CustomerId).FirstOrDefault();
            int    CardId       = (from card in entity.Card1 where card.CardName == CardName select card.CardId).FirstOrDefault();
            string msgClient    = null;

            if (customerId != 0 && CardId != 0)
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        var enditedCustomerCardValue = new LMS_Datas.CustomerCard
                        {
                            CustomerId     = customerId,
                            Cardid         = CardId,
                            referenceNo    = referenceNo,
                            CustomerCardId = id
                        };

                        entity.CustomerCards.Attach(enditedCustomerCardValue);
                        entity.Entry(enditedCustomerCardValue).State = EntityState.Modified;
                        entity.SaveChanges();
                        msgClient = "Saved Successfully";
                    }
                    else
                    {
                        msgClient = "Validation data not successfully";
                    }
                }
                catch (Exception ex)
                {
                    msgClient = "Error in Retriving Data";
                }
            }
            else
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
        public string EditCard(Card1 Model, FormCollection form)
        {
            string msgClient      = null;
            string statusDDLValue = form["PackageName"].ToString();

            Model.PackagesId = (from pack in entity.Packages where pack.PackageName == statusDDLValue select pack.PackagesId).FirstOrDefault();
            if (Model.PackagesId != null)
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        var enditedCardValue = new LMS_Datas.Card1
                        {
                            Activate    = true,
                            CardName    = Model.CardName,
                            discountPer = Model.discountPer,
                            ValidFrom   = Model.ValidFrom,
                            ValidTo     = Model.ValidTo,
                            PackagesId  = Model.PackagesId
                        };
                        entity.Card1.Attach(enditedCardValue);
                        entity.SaveChanges();
                    }
                    else
                    {
                        msgClient = "Validation data not successfully";
                    }
                }
                catch (Exception ex)
                {
                    msgClient = "Error in Retriving Data";
                }
            }
            else
            {
                msgClient = "Invalid Package Selected";
            }
            return(msgClient);
        }
Exemplo n.º 13
0
        public string EditPackage(Point Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedPointsValue = new LMS_Datas.Point
                    {
                        Active   = true,
                        Points   = Model.Points,
                        Amount   = Model.Amount,
                        PointsId = Model.PointsId
                    };

                    entity.Points.Attach(enditedPointsValue);
                    entity.Entry(enditedPointsValue).Property(x => x.Active).IsModified   = true;
                    entity.Entry(enditedPointsValue).Property(x => x.Points).IsModified   = true;
                    entity.Entry(enditedPointsValue).Property(x => x.PointsId).IsModified = true;
                    entity.Entry(enditedPointsValue).Property(x => x.Amount).IsModified   = true;
                    //entity.Entry(enditedPackageValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
Exemplo n.º 14
0
        // Admin is Client Here
        public string EditVoucher(Voucher Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedVoucherValue = new LMS_Datas.Voucher
                    {
                        Activate    = true,
                        VoucherName = Model.VoucherName,
                        description = Model.description,
                        ValidFrom   = Model.ValidFrom,
                        ValidTo     = Model.ValidTo,
                        VoucherId   = Model.VoucherId,
                        persons     = Model.persons
                    };

                    entity.Vouchers.Attach(enditedVoucherValue);

                    entity.Entry(enditedVoucherValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
        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());
            }
        }
Exemplo n.º 17
0
        public ActionResult Index(LMS_Datas.Desk model, FormCollection form, HttpPostedFileBase files)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        var addDesk = new LMS_Datas.Desk()
                        {
                            DeskName = model.DeskName,
                            Password = model.Password,
                            DeskNo   = model.DeskNo,
                            Active   = model.Active,
                            UserName = model.UserName
                        };
                        context.Desks.Add(addDesk);

                        context.SaveChanges();

                        if (files.FileName != null)
                        {
                            var    ext    = Path.GetExtension(files.FileName);
                            string myfile = addDesk.DeskId + ext;
                            var    path   = Path.Combine(Server.MapPath("~/Images/DeskProfile"), myfile);
                            files.SaveAs(path);
                        }
                    }
                    ViewBag.alert = "Success";
                    return(View());
                }
                ViewBag.alert = "Error";
                return(View(model));
            }
            catch (Exception e1)
            {
                ViewBag.alert = "Error";
                return(View());
            }
        }
Exemplo n.º 18
0
        public string EditCountry(country Model)
        {
            string msg;

            try
            {
                if (ModelState.IsValid)
                {
                    entity.Entry(Model).State = EntityState.Modified;
                    entity.SaveChanges();
                    msg = "Saved Successfully";
                }
                else
                {
                    msg = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msg = "Error occured:" + ex.Message;
            }
            return(msg);
        }
Exemplo n.º 19
0
        public ActionResult Index(Voucher model, FormCollection form)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string statusDDLValue = form["Statusddl"].ToString();
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        var addVoucher = new LMS_Datas.Voucher()
                        {
                            Activate    = true,
                            description = model.description,
                            Discountper = model.Discountper,
                            ValidFrom   = model.ValidFrom,
                            ValidTo     = model.ValidTo,
                            VoucherName = model.VoucherName,
                            PackagesId  = model.PackagesId,
                            persons     = model.persons
                        };
                        context.Vouchers.Add(addVoucher);

                        //context.ClientDetails.Add(clientDetails);
                        //etc add your other classes
                        context.SaveChanges();
                    }
                    ViewBag.PackageDd = new SelectList(entity.Packages.Where(models => models.Active == true), "PackagesId", "PackageName");
                    ViewBag.alert     = "Success";
                }
            }
            catch (Exception e1)
            {
                ViewBag.alert = "Error";
            }
            return(View());
        }
        public ActionResult Index(AdminViewModel model, FormCollection form, HttpPostedFileBase files)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string statusDDLValue = form["Statusddl"].ToString();
                    string genderDDLValue = form["genderddl"].ToString();

                    //var clientId= entity.InsertUpdateSelectAdmin(0, model.name, model.Address, model.MobileNo, model.EmailId, genderDDLValue, model.dob, model.countryId, model.stateId, model.cityId, 1, );
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        // Client is Admin
                        var admin = new LMS_Datas.Admin()
                        {
                            Name      = model.ClientName,
                            Address   = model.Address,
                            dob       = model.dob,
                            EmailId   = model.EmailId,
                            MobileNo  = model.MobileNo,
                            gender    = genderDDLValue,
                            countryId = model.countryId,
                            stateId   = model.stateId,
                            cityId    = model.cityId,
                            Active    = Boolean.Parse(statusDDLValue)
                        };
                        context.Admins.Add(admin);

                        //context.ClientDetails.Add(clientDetails);
                        //etc add your other classes
                        context.SaveChanges();
                        admin.AdminId = admin.AdminId;

                        var adminLogin = new LMS_Datas.Login()
                        {
                            LoginId  = admin.AdminId,
                            UserName = model.UserName,
                            Role     = "Client",
                            Password = model.Password
                        };
                        context.Logins.Add(adminLogin);
                        context.SaveChanges();
                        if (files.FileName != null)
                        {
                            var    ext    = Path.GetExtension(files.FileName);
                            string myfile = admin.AdminId + ext;
                            var    path   = Path.Combine(Server.MapPath("~/Images/ClientProfile"), myfile);
                            files.SaveAs(path);
                        }
                    }
                    ViewBag.CountryDd = new SelectList(entity.countries.Where(models => models.Active == true), "countryId", "countryName");
                    ViewBag.alert     = "Success";
                    return(View());
                }
                ViewBag.CountryDd = new SelectList(entity.countries.Where(models => models.Active == true), "countryId", "countryName");
                ViewBag.alert     = "Error";
                return(View(model));
            }
            catch (Exception e1)
            {
                ViewBag.CountryDd = new SelectList(entity.countries.Where(models => models.Active == true), "countryId", "countryName");
                ViewBag.alert     = "Error";
                return(View());
            }
        }