public async Task <ActionResult> UpdateHostingDetails(TBL_WHITE_LEVEL_HOSTING_DETAILS value, HttpPostedFileBase MotoFile, HttpPostedFileBase LogoFile, HttpPostedFileBase BannerFile)
        {
            var db = new DBContext();

            using (System.Data.Entity.DbContextTransaction ContextTransaction = db.Database.BeginTransaction())
            {
                try
                {
                    long slno        = long.Parse(value.SLN.ToString());
                    var  hostinginfo = await db.TBL_WHITE_LEVEL_HOSTING_DETAILS.Where(x => x.SLN == slno).FirstOrDefaultAsync();

                    string Motofilename   = string.Empty;
                    string Logofilename   = string.Empty;
                    string Bannerfilename = string.Empty;
                    if (MotoFile != null)
                    {
                        var MotoFileName       = value.MEM_ID + "_" + value.LONG_CODE + "_" + System.DateTime.Now + "_" + Path.GetFileName(MotoFile.FileName);
                        var MotoServerSavePath = Path.Combine(Server.MapPath("~/MemberHostingFiles/") + MotoFileName);
                        Motofilename = "~/MemberHostingFiles/" + MotoFileName;
                        MotoFile.SaveAs(MotoServerSavePath);
                        //value.MOTO = Motofilename;
                        hostinginfo.MOTO = Motofilename;
                    }
                    if (LogoFile != null)
                    {
                        var LogoFileName       = value.MEM_ID + "_" + value.LONG_CODE + "_" + System.DateTime.Now + "_" + Path.GetFileName(LogoFile.FileName);
                        var LogoServerSavePath = Path.Combine(Server.MapPath("~/MemberHostingFiles/") + LogoFileName);
                        Logofilename = "~/MemberHostingFiles/" + LogoFileName;
                        LogoFile.SaveAs(LogoServerSavePath);
                        //value.LOGO = Logofilename;
                        hostinginfo.LOGO = Logofilename;
                    }
                    if (BannerFile != null)
                    {
                        var BannerFileName       = value.MEM_ID + "_" + value.LONG_CODE + "_" + System.DateTime.Now + "_" + Path.GetFileName(BannerFile.FileName);
                        var BannerServerSavePath = Path.Combine(Server.MapPath("~/MemberHostingFiles/") + BannerFileName);
                        Bannerfilename = "~/MemberHostingFiles/" + BannerFileName;
                        BannerFile.SaveAs(BannerServerSavePath);
                        //value.BANNER = Bannerfilename;
                        hostinginfo.BANNER = Bannerfilename;
                    }
                    hostinginfo.COMPANY_NAME    = value.COMPANY_NAME;
                    hostinginfo.DOMAIN          = value.DOMAIN;
                    hostinginfo.LONG_CODE       = value.LONG_CODE;
                    db.Entry(hostinginfo).State = System.Data.Entity.EntityState.Modified;
                    await db.SaveChangesAsync();

                    ContextTransaction.Commit();
                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    ContextTransaction.Rollback();
                    Logger.Error("Controller:-  PowerAdminHostin(Distributor), method:- UpdateHostingDetails (POST) Line No:- 388", ex);
                    return(RedirectToAction("Exception", "ErrorHandler", new { area = "" }));

                    throw ex;
                }
            }
        }
        public async Task <ActionResult> UpdateHostingDetails(string memid = "")
        {
            initpage();////
            try
            {
                if (memid != null)
                {
                    string decrptSlId  = Decrypt.DecryptMe(memid);
                    long   Memid       = long.Parse(decrptSlId);
                    var    db          = new DBContext();
                    var    HostingInfo = await db.TBL_WHITE_LEVEL_HOSTING_DETAILS.FirstOrDefaultAsync(x => x.SLN == Memid);

                    var MemberInfo = await db.TBL_MASTER_MEMBER.FirstOrDefaultAsync(x => x.MEM_ID == HostingInfo.MEM_ID);

                    ViewBag.MemberId   = memid;
                    ViewBag.membername = MemberInfo.MEMBER_NAME;
                    var hostingdetails = new TBL_WHITE_LEVEL_HOSTING_DETAILS();
                    hostingdetails.MEM_ID = Memid;
                    return(View(HostingInfo));
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Controller:-  MemberHosting(Admin), method:- UpdateHostingDetails (GET) Line No:- 334", ex);
                return(RedirectToAction("Exception", "ErrorHandler", new { area = "" }));

                throw ex;
            }
        }
        public async Task <ActionResult> UpdateHostingDetails(string memid = "")
        {
            try
            {
                if (memid != null)
                {
                    string decrptSlId  = Decrypt.DecryptMe(memid);
                    long   Memid       = long.Parse(decrptSlId);
                    var    db          = new DBContext();
                    var    HostingInfo = await db.TBL_WHITE_LEVEL_HOSTING_DETAILS.FirstOrDefaultAsync(x => x.SLN == Memid);

                    var MemberInfo = await db.TBL_MASTER_MEMBER.FirstOrDefaultAsync(x => x.MEM_ID == HostingInfo.MEM_ID);

                    ViewBag.MemberId   = memid;
                    ViewBag.membername = MemberInfo.MEMBER_NAME;
                    var hostingdetails = new TBL_WHITE_LEVEL_HOSTING_DETAILS();
                    hostingdetails.MEM_ID = Memid;
                    return(View(HostingInfo));
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <ActionResult> HostingDetails(string memid = "")
        {
            initpage();////
            if (Session["WhiteLevelUserId"] != null)
            {
                try
                {
                    if (memid != null)
                    {
                        string decrptSlId = Decrypt.DecryptMe(memid);
                        long   Memid      = long.Parse(decrptSlId);
                        var    db         = new DBContext();
                        var    membInfo   = await db.TBL_MASTER_MEMBER.FirstOrDefaultAsync(x => x.MEM_ID == Memid);

                        ViewBag.MemberId   = memid;
                        ViewBag.membername = membInfo.MEMBER_NAME;
                        //var hostingdetails = new TBL_WHITE_LEVEL_HOSTING_DETAILS();
                        var hostingdetails = await db.TBL_WHITE_LEVEL_HOSTING_DETAILS.FirstOrDefaultAsync(x => x.MEM_ID == Memid);

                        if (hostingdetails != null)
                        {
                            ViewBag.checkbtn      = "1";
                            hostingdetails.MEM_ID = Memid;

                            return(View(hostingdetails));
                        }
                        else
                        {
                            var hostingdetails1 = new TBL_WHITE_LEVEL_HOSTING_DETAILS();
                            ViewBag.checkbtn       = "0";
                            hostingdetails1.MEM_ID = Memid;

                            return(View(hostingdetails1));
                        }
                    }
                    return(View());
                }
                catch (Exception ex)
                {
                    Logger.Error("Controller:-  MemberHosting(Admin), method:- HostingDetails (GET) Line No:- 161", ex);
                    return(RedirectToAction("Exception", "ErrorHandler", new { area = "" }));

                    throw ex;
                }
            }
            else
            {
                Session["WhiteLevelUserId"]   = null;
                Session["WhiteLevelUserName"] = null;
                Session["UserType"]           = null;
                Session.Remove("WhiteLevelUserId");
                Session.Remove("WhiteLevelUserName");
                Session.Remove("UserType");
                return(RedirectToAction("Index", "Login", new { area = "" }));
            }
        }
        public async Task <ActionResult> HostingDetails(string memid = "")
        {
            if (Session["SuperDistributorId"] != null)
            {
                try
                {
                    if (memid != null)
                    {
                        string decrptSlId = Decrypt.DecryptMe(memid);
                        long   Memid      = long.Parse(decrptSlId);
                        var    db         = new DBContext();
                        var    membInfo   = await db.TBL_MASTER_MEMBER.FirstOrDefaultAsync(x => x.MEM_ID == Memid);

                        ViewBag.MemberId   = memid;
                        ViewBag.membername = membInfo.MEMBER_NAME;
                        //var hostingdetails = new TBL_WHITE_LEVEL_HOSTING_DETAILS();
                        var hostingdetails = await db.TBL_WHITE_LEVEL_HOSTING_DETAILS.FirstOrDefaultAsync(x => x.MEM_ID == Memid);

                        if (hostingdetails != null)
                        {
                            ViewBag.checkbtn      = "1";
                            hostingdetails.MEM_ID = Memid;

                            return(View(hostingdetails));
                        }
                        else
                        {
                            var hostingdetails1 = new TBL_WHITE_LEVEL_HOSTING_DETAILS();
                            ViewBag.checkbtn       = "0";
                            hostingdetails1.MEM_ID = Memid;

                            return(View(hostingdetails1));
                        }
                    }
                    return(View());
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                Session["SuperDistributorId"]       = null;
                Session["SuperDistributorUserName"] = null;
                Session["UserType"] = null;
                Session.Remove("SuperDistributorId");
                Session.Remove("SuperDistributorUserName");
                Session.Remove("UserType");
                return(RedirectToAction("Index", "SuperLogin", new { area = "Super" }));
            }
        }
        public ActionResult HostingDetails(string memid = "")
        {
            try
            {
                if (memid != null)
                {
                    string decrptSlId = Decrypt.DecryptMe(memid);
                    long   Memid      = long.Parse(decrptSlId);
                    var    db         = new DBContext();
                    var    membInfo   = db.TBL_MASTER_MEMBER.FirstOrDefault(x => x.MEM_ID == Memid);
                    ViewBag.MemberId   = memid;
                    ViewBag.membername = membInfo.MEMBER_NAME;
                    //var hostingdetails = new TBL_WHITE_LEVEL_HOSTING_DETAILS();
                    var hostingdetails = db.TBL_WHITE_LEVEL_HOSTING_DETAILS.FirstOrDefault(x => x.MEM_ID == Memid);
                    if (hostingdetails != null)
                    {
                        ViewBag.checkbtn      = "1";
                        hostingdetails.MEM_ID = Memid;

                        return(View(hostingdetails));
                    }
                    else
                    {
                        var hostingdetails1 = new TBL_WHITE_LEVEL_HOSTING_DETAILS();
                        ViewBag.checkbtn       = "0";
                        hostingdetails1.MEM_ID = Memid;

                        return(View(hostingdetails1));
                    }
                }
                return(View());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <ActionResult> HostingDetails(TBL_WHITE_LEVEL_HOSTING_DETAILS value, HttpPostedFileBase MotoFile, HttpPostedFileBase LogoFile, HttpPostedFileBase BannerFile)
        {
            initpage();////
            var db = new DBContext();

            using (System.Data.Entity.DbContextTransaction ContextTransaction = db.Database.BeginTransaction())
            {
                try
                {
                    var checkhosting = await db.TBL_WHITE_LEVEL_HOSTING_DETAILS.Where(x => x.MEM_ID == value.MEM_ID).FirstOrDefaultAsync();

                    if (checkhosting != null)
                    {
                        string Motofilename   = string.Empty;
                        string Logofilename   = string.Empty;
                        string Bannerfilename = string.Empty;
                        if (MotoFile != null)
                        {
                            string Motopath      = Path.GetFileName(MotoFile.FileName);
                            string MotofileName  = Motopath.Substring(Motopath.LastIndexOf(((char)92)) + 1);
                            int    index         = MotofileName.LastIndexOf('.');
                            string onyName       = MotofileName.Substring(0, index);
                            string fileExtension = MotofileName.Substring(index + 1);

                            var MotoFileName       = "Moto-" + value.MEM_ID + "_" + value.LONG_CODE + "." + fileExtension;
                            var MotoServerSavePath = Path.Combine(Server.MapPath(@"/MemberHostingFiles/") + MotoFileName);
                            Motofilename = "/MemberHostingFiles/" + MotoFileName;
                            MotoFile.SaveAs(MotoServerSavePath);
                            checkhosting.MOTO = Motofilename;
                        }
                        if (LogoFile != null)
                        {
                            string Logopath      = Path.GetFileName(LogoFile.FileName);
                            string LogofileName  = Logopath.Substring(Logopath.LastIndexOf(((char)92)) + 1);
                            int    index         = LogofileName.LastIndexOf('.');
                            string onyName       = LogofileName.Substring(0, index);
                            string fileExtension = LogofileName.Substring(index + 1);

                            var LogoFileName       = "Logo-" + value.MEM_ID + "_" + value.LONG_CODE + "." + fileExtension;
                            var LogoServerSavePath = Path.Combine(Server.MapPath(@"/MemberHostingFiles/") + LogoFileName);
                            Logofilename = "/MemberHostingFiles/" + LogoFileName;
                            LogoFile.SaveAs(LogoServerSavePath);
                            checkhosting.LOGO = Logofilename;
                        }
                        if (BannerFile != null)
                        {
                            string Bannerpath     = Path.GetFileName(BannerFile.FileName);
                            string BannerfileName = Bannerpath.Substring(Bannerpath.LastIndexOf(((char)92)) + 1);
                            int    index          = BannerfileName.LastIndexOf('.');
                            string onyName        = BannerfileName.Substring(0, index);
                            string fileExtension  = BannerfileName.Substring(index + 1);

                            var BannerFileName       = "Banner-" + value.MEM_ID + "_" + value.LONG_CODE + "." + fileExtension;
                            var BannerServerSavePath = Path.Combine(Server.MapPath(@"/MemberHostingFiles/") + BannerFileName);
                            Bannerfilename = "/MemberHostingFiles/" + BannerFileName;
                            BannerFile.SaveAs(BannerServerSavePath);
                            checkhosting.BANNER = Bannerfilename;
                        }
                        checkhosting.COMPANY_NAME    = value.COMPANY_NAME;
                        checkhosting.DOMAIN          = value.DOMAIN;
                        checkhosting.LONG_CODE       = value.LONG_CODE;
                        db.Entry(checkhosting).State = System.Data.Entity.EntityState.Modified;
                        await db.SaveChangesAsync();
                    }
                    else
                    {
                        string Motofilename   = string.Empty;
                        string Logofilename   = string.Empty;
                        string Bannerfilename = string.Empty;
                        if (MotoFile != null)
                        {
                            string Motopath      = Path.GetFileName(MotoFile.FileName);
                            string MotofileName  = Motopath.Substring(Motopath.LastIndexOf(((char)92)) + 1);
                            int    index         = MotofileName.LastIndexOf('.');
                            string onyName       = MotofileName.Substring(0, index);
                            string fileExtension = MotofileName.Substring(index + 1);

                            var MotoFileName       = "Moto-" + value.MEM_ID + "_" + value.LONG_CODE + "." + fileExtension;
                            var MotoServerSavePath = Path.Combine(Server.MapPath(@"/MemberHostingFiles/") + MotoFileName);
                            Motofilename = "/MemberHostingFiles/" + MotoFileName;
                            MotoFile.SaveAs(MotoServerSavePath);
                            value.MOTO = Motofilename;
                        }
                        if (LogoFile != null)
                        {
                            string Logopath      = Path.GetFileName(LogoFile.FileName);
                            string LogofileName  = Logopath.Substring(Logopath.LastIndexOf(((char)92)) + 1);
                            int    index         = LogofileName.LastIndexOf('.');
                            string onyName       = LogofileName.Substring(0, index);
                            string fileExtension = LogofileName.Substring(index + 1);

                            var LogoFileName       = "Logo-" + value.MEM_ID + "_" + value.LONG_CODE + "." + fileExtension;
                            var LogoServerSavePath = Path.Combine(Server.MapPath(@"/MemberHostingFiles/") + LogoFileName);
                            Logofilename = "/MemberHostingFiles/" + LogoFileName;
                            LogoFile.SaveAs(LogoServerSavePath);
                            value.LOGO = Logofilename;
                        }
                        if (BannerFile != null)
                        {
                            string Bannerpath     = Path.GetFileName(BannerFile.FileName);
                            string BannerfileName = Bannerpath.Substring(Bannerpath.LastIndexOf(((char)92)) + 1);
                            int    index          = BannerfileName.LastIndexOf('.');
                            string onyName        = BannerfileName.Substring(0, index);
                            string fileExtension  = BannerfileName.Substring(index + 1);

                            var BannerFileName       = "Banner-" + value.MEM_ID + "_" + value.LONG_CODE + "." + fileExtension;
                            var BannerServerSavePath = Path.Combine(Server.MapPath(@"/MemberHostingFiles/") + BannerFileName);
                            Bannerfilename = "/MemberHostingFiles/" + BannerFileName;
                            BannerFile.SaveAs(BannerServerSavePath);
                            value.BANNER = Bannerfilename;
                        }
                        db.TBL_WHITE_LEVEL_HOSTING_DETAILS.Add(value);
                        await db.SaveChangesAsync();
                    }
                    ContextTransaction.Commit();
                    return(RedirectToAction("Index", "MemberHosting", new { area = "Admin" }));
                    //}
                    //return View();
                }
                catch (Exception ex)
                {
                    Logger.Error("Controller:-  MemberHosting(Admin), method:- HostingDetails (POST) Line No:- 298", ex);
                    ContextTransaction.Rollback();
                    return(RedirectToAction("Exception", "ErrorHandler", new { area = "" }));
                }
            }
        }