Example #1
0
        static void Main()
        {
            Mathmatics   math = new Mathmatics();
            WorkDelegate work = math.Calculate;

            work('+', 10, 5);
        }
Example #2
0
 public ActionResult DeleteFile(int?Id)
 {
     using (var tran = db.Database.BeginTransaction())
     {
         try
         {
             string         filePath = null;
             long?          UserID   = Convert.ToInt64(User.Identity.Name);
             FileCollection fileCol  = db.FileCollections.FirstOrDefault(x => x.Id == Id && x.UserID == UserID);
             filePath = Server.MapPath("~/" + fileCol.FilePath);
             db.FileCollections.Remove(fileCol);
             db.SaveChanges();
             if (!string.IsNullOrEmpty(filePath))
             {
                 if (System.IO.File.Exists(filePath))
                 {
                     long length = new System.IO.FileInfo(filePath).Length;
                     System.IO.File.Delete(filePath);
                     UserUsage userUsage = db.UserUsages.FirstOrDefault(x => x.UserID == UserID);
                     userUsage.UsedStorage = userUsage.UsedStorage - Mathmatics.ConvertBytesToMegabytes(length);
                     db.SaveChanges();
                 }
             }
             tran.Commit();
         }
         catch (Exception er)
         {
             tran.Rollback();
         }
     }
     return(RedirectToAction("UploadImage"));
 }
        public ActionResult Create(Product product, HttpPostedFileBase file)
        {
            long?UserID = Convert.ToInt64(User.Identity.Name);

            if (ModelState.IsValid)
            {
                string pic = "";
                if (file != null)
                {
                    if (file.ContentLength != 0)
                    {
                        pic = System.IO.Path.GetFileName(file.FileName);
                        pic = Guid.NewGuid() + "_" + pic;
                        string path = System.IO.Path.Combine(Server.MapPath("~/Content/upload/" + UserID + "/Commerce"), pic);
                        // file is uploaded
                        file.SaveAs(path);
                        //   product.ProductImage = "Content/upload/" + UserID + "/Commerce/" + pic;
                        product.ProductImage = "/xImage/" + UserID + "/Commerce/" + pic;
                        UserUsage userUsage = db.UserUsages.FirstOrDefault(x => x.UserID == UserID);
                        userUsage.UsedStorage += Mathmatics.ConvertBytesToMegabytes(file.ContentLength);
                        db.SaveChanges();
                    }
                }

                product.UserID = UserID;
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CatagoryID = new SelectList(db.ProductCatagories.Where(x => x.UserID == UserID), "Id", "CatagoryName");
            return(View(product));
        }
Example #4
0
        static void Main(string[] args)
        {
            Mathmatics   math = new Mathmatics();
            WorkDelegate work = math.Calculate;

            work('+', 10, 5);
            work('-', 10, 5);
            work('*', 10, 5);
            work('/', 10, 5);
        }
Example #5
0
        public _4_07_delegate()
        {
            Mathmatics math = new Mathmatics();

            math.Calculate('+', 6, 3);
            math.Calculate('-', 6, 3);
            math.Calculate('*', 6, 3);
            math.Calculate('/', 6, 3);

            math.CalculateAll(10, 5);
        }
Example #6
0
        public void Test_Mathmatics_Quotient()
        {
            Mathmatics math           = new Mathmatics();
            int        first          = 10;
            int        second         = 20;
            double     expectedResult = 2.0;

            double actualResult = math.quotient(second, first);

            Assert.AreEqual(expectedResult, actualResult);
        }
Example #7
0
        public void TestMethod1()
        {
            Mathmatics math           = new Mathmatics();
            int        first          = 10;
            int        second         = 20;
            int        expectedResult = 31;

            int actualResult = math.add(first, second);

            Assert.AreEqual(expectedResult, actualResult);
        }
Example #8
0
        public ActionResult UploadImage(HttpPostedFileBase file)
        {
            string pic    = "";
            var    UserID = Convert.ToInt64(User.Identity.Name);

            using (var trans = db.Database.BeginTransaction())
            {
                try
                {
                    if (file != null)
                    {
                        if (file.ContentLength != 0)
                        {
                            FileCollection fileCol = new FileCollection();
                            if (!System.IO.Directory.Exists(Server.MapPath("~/Content/upload")))
                            {
                                System.IO.Directory.CreateDirectory(Server.MapPath("~/Content/upload"));
                            }
                            pic = System.IO.Path.GetFileName(file.FileName);
                            string picExtention = System.IO.Path.GetExtension(pic);
                            pic = Guid.NewGuid() + "_a" + picExtention;
                            string path = System.IO.Path.Combine(Server.MapPath("~/Content/upload/" + UserID), pic);
                            // file uploading
                            file.SaveAs(path);
                            // string filePath = "http://" + Request.ServerVariables["HTTP_HOST"] + "/Content/filecollection/" + pic;
                            string filePath = "Content/upload/" + UserID + "/" + pic;
                            fileCol.FilePath = filePath;
                            fileCol.UserID   = UserID;
                            db.FileCollections.Add(fileCol);
                            db.SaveChanges();
                            UserUsage userUsage = db.UserUsages.FirstOrDefault(x => x.UserID == UserID);
                            userUsage.UsedStorage += Mathmatics.ConvertBytesToMegabytes(file.ContentLength);
                            db.SaveChanges();
                            trans.Commit();
                            TempData["Msg"] = "<h2 class='text-center' style='display: block; color: green'>File has been uploaded</h2><p><b>Link to Copy:  </b> " + filePath + "</p>";
                            return(RedirectToAction("UploadImage"));
                        }
                        else
                        {
                            TempData["Msg"] = "<h2 class='text-center' style='display: block; color: green'>File not uploaded.  Please try agian</h2>";
                            return(RedirectToAction("UploadImage"));
                        }
                    }
                }
                catch (Exception er)
                {
                    trans.Rollback();
                }
            }
            TempData["Msg"] = "<h2 class='text-center' style='display: block; color: green'>There is an error please try again.</h2>";
            return(RedirectToAction("UploadImage"));
        }
        private void QueueUI(double timeDelta)
        {
            (int windowWidth, int windowHeight) = GameEngine.windowHandler.GetWindowDimensions();
            double uiScale = windowWidth > windowHeight ? windowWidth / 1920d : windowHeight / 1080d;

            textMesh = TextMeshGenerator.RegenerateMesh($"Vector Engine\n" +
                                                        $"VSync: {UseVSync}\n" +
                                                        $"FPS: {((int)(1 / timeDelta * 10)) / 10f}",
                                                        arialFont, textMesh, 2, 50);

            RenderEngine.AddToRenderQueue(uiMaterial, treeMesh, Mathmatics.CreateTransformationMatrix(new Vector3d(1, 0, 0) / uiScale, Vector3d.Zero, new Vector3d(250d / windowWidth, 250d / windowHeight, 1) * uiScale), true);
            //RenderEngine.AddToRenderQueue(uiMaterial, treeMesh, Mathmatics.CreateTransformationMatrix(new Vector3d(0, 0, 0) / uiScale, Vector3d.Zero, new Vector3d(0.5d, 0.5d, 1) * uiScale), true);
            RenderEngine.AddToRenderQueue(arialFontMaterial, textMesh, Mathmatics.CreateTransformationMatrix(new Vector3d(-windowWidth + 50, windowHeight - 50, 0) / uiScale, Vector3d.Zero, new Vector3d(1d / windowWidth, 1d / windowHeight, 1) * uiScale), true);
        }
        public void OnRender(double timeDelta)
        {
            double time = (DateTime.UtcNow - engineStartTime).TotalSeconds;

            secondCamera.Position = new Vector3d(Math.Sin(time) * 5, 3, Math.Cos(time) * 5);
            secondCamera.Rotation = new Vector3d(25, -Math.Atan2(Math.Sin(time), Math.Cos(time)) * 180 / Mathmatics.PI, 0);

            RenderEngine.AddCamera(camera);
            RenderEngine.AddCamera(secondCamera);
            RenderEngine.AddLight(light);
            RenderEngine.AddLight(mainLight);
            RenderEngine.AddLight(anotherLight);

            QueueUI(timeDelta);

            RenderEngine.AddToRenderQueue(standardMaterial, treeMesh, Mathmatics.CreateTransformationMatrix(new Vector3d(0, 0, 0), Vector3d.Zero, Vector3d.One), false);
            RenderEngine.AddToRenderQueue(standardMaterial, treeMesh, Mathmatics.CreateTransformationMatrix(new Vector3d(0, 0, -5), Vector3d.Zero, Vector3d.One), false);
        }
Example #11
0
        public async Task <ActionResult> Edit(ShopUser shopUser, HttpPostedFileBase file)
        {
            using (var Tran = db.Database.BeginTransaction())
            {
                try
                {
                    // validate current sub domain
                    domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
                    var User = domainIndentifier.GetUserRelatedDomain();
                    UserID                   = User != null ? User.Id : 0;
                    ViewBag.UserID           = UserID;
                    Session["CurrentUserID"] = UserID;

                    //// check user is login or not
                    if (string.IsNullOrEmpty(Convert.ToString(Session["WebloggedUserID"])))
                    {
                        return(Redirect("/Account/Login"));
                    }

                    // bussiness logic
                    long ShopUserID = Convert.ToInt64(Session["WebloggedUserID"]);
                    ViewBag.ShopUserID = ShopUserID;

                    if (ModelState.IsValid)
                    {
                        ShopUser Customer = db.ShopUsers.FirstOrDefault(x => x.Id == ShopUserID);
                        if (!System.IO.Directory.Exists(Server.MapPath("~/Content/upload/" + UserID + "/Commerce")))
                        {
                            System.IO.Directory.CreateDirectory(Server.MapPath("~/Content/upload/" + UserID + "/ShopUsers"));
                        }

                        if (file != null)
                        {
                            if (file.ContentLength > 0)
                            {
                                string FileExtention = Path.GetExtension(file.FileName);
                                string FileName      = Guid.NewGuid().ToString() + DateTime.Now.ToString("yyyydd") + ShopUserID + FileExtention;
                                string FileSavePath  = System.IO.Path.Combine(Server.MapPath("~/Content/upload/" + UserID + "/ShopUsers"), FileName);
                                file.SaveAs(FileSavePath);
                                Customer.ProfileImagePath = "Content/upload/" + UserID + "/ShopUsers" + FileName;
                            }
                        }
                        int    IsSavedIntoStorageTable = 0;
                        string PreProfilePath          = Customer.ProfileImagePath;
                        Customer.CurrentAddress   = shopUser.CurrentAddress;
                        Customer.DisplayName      = shopUser.DisplayName;
                        Customer.Email            = shopUser.Email;
                        Customer.FirstName        = shopUser.FirstName;
                        Customer.LastName         = shopUser.LastName;
                        Customer.Mobile           = shopUser.Mobile;
                        Customer.Password         = shopUser.Password;
                        Customer.PermanentAddress = shopUser.PermanentAddress;
                        Customer.Phone            = shopUser.Phone;
                        Customer.SecPhone         = shopUser.SecPhone;
                        int isSavedIntoShopUser = await db.SaveChangesAsync();      // Insert Data

                        if (!string.IsNullOrEmpty(PreProfilePath))
                        {
                            string fileToDelete = Server.MapPath("~/" + PreProfilePath);
                            if (!string.IsNullOrEmpty(fileToDelete))
                            {
                                if (System.IO.File.Exists(fileToDelete))
                                {
                                    long      length     = new System.IO.FileInfo(fileToDelete).Length;
                                    UserUsage PriHistory = db.UserUsages.FirstOrDefault(x => x.UserID == UserID);
                                    PriHistory.UsedStorage  = PriHistory.UsedStorage - Mathmatics.ConvertBytesToMegabytes(length);
                                    IsSavedIntoStorageTable = db.SaveChanges();                           // Insert Data
                                    System.IO.File.Delete(fileToDelete);
                                }
                            }
                        }
                        if (isSavedIntoShopUser > 0 && IsSavedIntoStorageTable > 0)
                        {
                            Tran.Commit();
                            return(RedirectToAction("Detail"));
                        }
                        return(View(shopUser));
                    }
                }
                catch (Exception er)
                {
                    Tran.Rollback();
                }
                return(View(shopUser));
            }
        }
Example #12
0
        public void MoveDirectionBased(Vector3d movement)
        {
            Vector3d toAdd = (Vector3d)(Quaternion.FromEulerAngles(0, (float)Mathmatics.ConvertToRadians(-Rotation.Y), 0) * (Vector3)movement);

            Position += toAdd;
        }
Example #13
0
        private void RecreateProjectionMatrix()
        {
            (int width, int height) = GameEngine.windowHandler.GetWindowDimensions();
            float aspectRatio = (width * ViewPortSize.X) / (height * ViewPortSize.Y);

            projectionMatrix = IsPerspective ? Matrix4.CreatePerspectiveFieldOfView((float)Mathmatics.ConvertToRadians(FOV), aspectRatio, NearPlane, FarPlane) : Matrix4.CreateOrthographic((int)(width * ViewPortSize.X), (int)(height * ViewPortSize.Y), NearPlane, FarPlane);
        }
        public ActionResult Edit(Product productModel, HttpPostedFileBase file)
        {
            long?UserID  = Convert.ToInt64(User.Identity.Name);
            var  product = db.Products.FirstOrDefault(x => x.UserID == UserID && x.Id == productModel.Id);

            using (var Tran = db.Database.BeginTransaction())
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        string oldImage = product.ProductImage;
                        string pic      = "";
                        if (file != null)
                        {
                            if (file.ContentLength != 0)
                            {
                                pic = System.IO.Path.GetFileName(file.FileName);
                                pic = Guid.NewGuid() + "_" + pic;
                                string path = System.IO.Path.Combine(Server.MapPath("~/Content/upload/" + UserID + "/Commerce"), pic);
                                // file is uploaded
                                file.SaveAs(path);
                                // product.ProductImage = "Content/upload/" + UserID + "/Commerce/" + pic;
                                product.ProductImage = "/xImage/" + UserID + "/Commerce/" + pic;
                                UserUsage userUsage = db.UserUsages.FirstOrDefault(x => x.UserID == UserID);
                                userUsage.UsedStorage += Mathmatics.ConvertBytesToMegabytes(file.ContentLength);
                                db.SaveChanges();
                            }
                        }

                        product.UserID          = UserID;
                        product.Name            = productModel.Name;
                        product.Description     = productModel.Description;
                        product.Discount        = productModel.Discount;
                        product.Price           = productModel.Price;
                        productModel.CatagoryID = productModel.CatagoryID;

                        db.SaveChanges();

                        if (!string.IsNullOrEmpty(oldImage))
                        {
                            string fileToDelete = Server.MapPath("~/" + oldImage);
                            if (!string.IsNullOrEmpty(fileToDelete))
                            {
                                if (System.IO.File.Exists(fileToDelete))
                                {
                                    long      length     = new System.IO.FileInfo(fileToDelete).Length;
                                    UserUsage PriHistory = db.UserUsages.FirstOrDefault(x => x.UserID == UserID);
                                    PriHistory.UsedStorage = PriHistory.UsedStorage - Mathmatics.ConvertBytesToMegabytes(length);
                                    db.SaveChanges();
                                    System.IO.File.Delete(fileToDelete);
                                }
                            }
                        }

                        return(RedirectToAction("Index"));
                    }
                    Tran.Commit();
                    ViewBag.CatagoryID = new SelectList(db.ProductCatagories.Where(x => x.UserID == UserID), "Id", "CatagoryName");
                }
                catch (Exception er)
                {
                    Tran.Rollback();
                }
            }
            return(View(product));
        }
        public ActionResult Edit(User user, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                using (var trasn = db.Database.BeginTransaction())
                {
                    try
                    {
                        long?  UserID     = Convert.ToInt64(User.Identity.Name);
                        User   detail     = db.Users.Find(UserID);
                        string OldPicPath = detail.ProfilePic;
                        string pic        = "";
                        if (file != null)
                        {
                            if (file.ContentLength != 0)
                            {
                                pic = System.IO.Path.GetFileName(file.FileName);
                                pic = Guid.NewGuid() + "_" + pic;
                                string path = System.IO.Path.Combine(Server.MapPath("~/Content/upload/" + UserID), pic);
                                // file is uploaded
                                file.SaveAs(path);
                                detail.ProfilePic = "Content/upload/" + UserID + "/" + pic;
                                UserUsage userUsage = db.UserUsages.FirstOrDefault(x => x.UserID == UserID);
                                userUsage.UsedStorage += Mathmatics.ConvertBytesToMegabytes(file.ContentLength);
                                db.SaveChanges();
                            }
                        }

                        detail.FirstName  = user.FirstName;
                        detail.LastName   = user.LastName;
                        detail.Email      = user.Email;
                        detail.Address    = user.Address;
                        detail.CellNumber = user.CellNumber;
                        detail.Password   = user.Password;

                        db.SaveChanges();
                        Session["UserProfilePath"] = detail.ProfilePic;
                        Session["UserFirstName"]   = !string.IsNullOrEmpty(detail.FirstName) ? detail.FirstName.ToUpper() : "Hi!";

                        if (!string.IsNullOrEmpty(OldPicPath))
                        {
                            string fileToDelete = Server.MapPath("~/" + OldPicPath);
                            if (!string.IsNullOrEmpty(fileToDelete))
                            {
                                if (System.IO.File.Exists(fileToDelete))
                                {
                                    long length = new System.IO.FileInfo(fileToDelete).Length;
                                    System.IO.File.Delete(fileToDelete);
                                    UserUsage PriHistory = db.UserUsages.FirstOrDefault(x => x.UserID == UserID);
                                    PriHistory.UsedStorage = PriHistory.UsedStorage - Mathmatics.ConvertBytesToMegabytes(length);
                                    db.SaveChanges();
                                }
                            }
                        }
                        trasn.Commit();
                        return(RedirectToAction("Index"));
                    }
                    catch (Exception er)
                    {
                        trasn.Rollback();
                    }
                }
            }
            return(View(user));
        }
        private static void DrawCameras(int width, int height, Camera[] cameraData, Light[] lightData)
        {
            Camera   camera;
            Material material;
            Dictionary <Mesh, Queue <Matrix4> > objectsToRender;
            Mesh currentMesh;

            Matrix4[] currentObjects;

            for (int cameraIndex = 0; cameraIndex < cameraData.Length; cameraIndex++)
            {
                // Initialize the camera and view port to prepare for rendering
                camera = cameraData[cameraIndex];
                int viewPortWidth  = (int)(camera.ViewPortSize.X * width);
                int viewPortHeight = (int)(camera.ViewPortSize.Y * height);
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, camera.fboId);
                GL.BindTexture(TextureTarget.Texture2D, camera.texId);

                GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, viewPortWidth, viewPortHeight, 0, PixelFormat.Rgba, PixelType.UnsignedByte, System.IntPtr.Zero);

                GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
                GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
                GL.BindTexture(TextureTarget.Texture2D, 0);

                GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, camera.texId, 0);

                // Create, initialize, and attach depth and stencil buffer
                GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, camera.bufId);
                GL.RenderbufferStorage(RenderbufferTarget.Renderbuffer, RenderbufferStorage.Depth24Stencil8, viewPortWidth, viewPortHeight);
                GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, 0);

                GL.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthStencilAttachment, RenderbufferTarget.Renderbuffer, camera.bufId);

                if (GL.CheckFramebufferStatus(FramebufferTarget.Framebuffer) != FramebufferErrorCode.FramebufferComplete)
                {
                    Debug.Log($"Frame buffer was not complete! BAIL! Error code: {GL.CheckFramebufferStatus(FramebufferTarget.Framebuffer).ToString()}");
                    return;
                }

                GL.Viewport(0, 0, viewPortWidth, viewPortHeight);

                ChangeClearColor(camera.ClearColor.X, camera.ClearColor.Y, camera.ClearColor.Z, camera.ClearColor.W);
                RenderPrepare();

                foreach (KeyValuePair <Material, Dictionary <Mesh, Queue <Matrix4> > > entry in objectRenderingQueue)
                {
                    material        = entry.Key;
                    objectsToRender = entry.Value;

                    material.Shader.EnableShader();

                    if (material.UsesLights)
                    {
                        material.SetLights(lightData);
                    }

                    if (material.UsesTime)
                    {
                        material.SetTimeData(timeSinceStart);
                    }

                    if (material.UsesViewMatrix)
                    {
                        material.SetMatrix("viewMatrix", Mathmatics.CreateViewMatrix(camera));
                    }

                    material.SetMatrix("projectionMatrix", camera.ProjectionMatrix);

                    foreach (KeyValuePair <Mesh, Queue <Matrix4> > renderEntry in objectsToRender)
                    {
                        currentMesh    = renderEntry.Key;
                        currentObjects = new Matrix4[renderEntry.Value.Count];
                        renderEntry.Value.CopyTo(currentObjects, 0);

                        GL.BindVertexArray(currentMesh.VaoID);

                        material.Shader.BeforeRenderGroup();

                        for (int i = 0; i < currentObjects.Length; i++)
                        {
                            material.Shader.BeforeRenderIndividual();

                            material.SetMatrix("transformationMatrix", currentObjects[i]);

                            GL.DrawElements(BeginMode.Triangles, currentMesh.VertexCount, DrawElementsType.UnsignedInt, 0);

                            material.Shader.AfterRenderInvividual();
                        }

                        GL.BindVertexArray(0);
                    }

                    material.Shader.AfterRenderGroup();

                    material.Shader.DisableShader();
                }
            }
        }
Example #17
0
        public ActionResult Edit(SiteSetting siteSetting, HttpPostedFileBase file)
        {
            using (var Transaction = db.Database.BeginTransaction())
            {
                long?UserID  = Convert.ToInt64(User.Identity.Name);
                var  setting = db.SiteSettings.FirstOrDefault(x => x.UserID == UserID);

                try
                {
                    if (ModelState.IsValid)
                    {
                        string OldLogoPath = setting.Logo;
                        string pic         = "";
                        if (file != null)
                        {
                            if (file.ContentLength != 0)
                            {
                                pic = System.IO.Path.GetFileName(file.FileName);
                                pic = Guid.NewGuid() + "_" + pic;
                                string path = System.IO.Path.Combine(Server.MapPath("~/Content/upload/" + UserID), pic);
                                // file is uploaded
                                file.SaveAs(path);
                                setting.Logo = "Content/upload/" + UserID + "/" + pic;
                                UserUsage userUsage = db.UserUsages.FirstOrDefault(x => x.UserID == UserID);
                                userUsage.UsedStorage += Mathmatics.ConvertBytesToMegabytes(file.ContentLength);
                                db.SaveChanges();
                            }
                        }

                        setting.Email           = siteSetting.Email;
                        setting.OfficeAddress   = siteSetting.OfficeAddress;
                        setting.Phone           = siteSetting.Phone;
                        setting.SmtpEmail       = siteSetting.SmtpEmail;
                        setting.SmtpIsEnableSSL = siteSetting.SmtpIsEnableSSL;
                        setting.SmtpPassword    = siteSetting.SmtpPassword;
                        setting.SmtpPort        = siteSetting.SmtpPort;
                        setting.SmtpServer      = siteSetting.SmtpServer;

                        db.SaveChanges();

                        if (!string.IsNullOrEmpty(OldLogoPath))
                        {
                            string fileToDelete = Server.MapPath("~/" + OldLogoPath);
                            if (!string.IsNullOrEmpty(fileToDelete))
                            {
                                if (System.IO.File.Exists(fileToDelete))
                                {
                                    long      length     = new System.IO.FileInfo(fileToDelete).Length;
                                    UserUsage PriHistory = db.UserUsages.FirstOrDefault(x => x.UserID == UserID);
                                    PriHistory.UsedStorage = PriHistory.UsedStorage - Mathmatics.ConvertBytesToMegabytes(length);
                                    db.SaveChanges();
                                    System.IO.File.Delete(fileToDelete);
                                }
                            }
                        }

                        Transaction.Commit();
                        return(RedirectToAction("Index"));
                    }
                }
                catch (Exception er)
                {
                    Transaction.Rollback();
                }
                return(View(setting));
            }
        }