Exemple #1
0
        public void TestOnBrowseStackdriverLogCommand()
        {
            string filter             = null;
            var    logsToolWindowMock = new Mock <LogsViewerToolWindow> {
                CallBase = true
            };

            logsToolWindowMock.Setup(w => w.ViewModel.FilterLog(It.IsAny <string>())).Callback((string s) => filter = s);
            logsToolWindowMock.Object.Frame = VsWindowFrameMocks.GetMockedWindowFrame();
            PackageMock.Setup(
                p => p.FindToolWindow <LogsViewerToolWindow>(false, It.IsAny <int>()))
            .Returns(() => null);
            PackageMock.Setup(p => p.FindToolWindow <LogsViewerToolWindow>(true, It.IsAny <int>()))
            .Returns(logsToolWindowMock.Object);
            var objectUnderTest = new VersionViewModel(
                new GaeSourceRootViewModel(),
                Mock.Of <Service>(s => s.Id == "ServiceId" && s.Split.Allocations == new Dictionary <string, double?>()),
                new Version {
                Id = "VersionId"
            }, true);

            MenuItem logsMenuItem = objectUnderTest.ContextMenu.ItemsSource.OfType <MenuItem>().Single(
                mi => mi.Header.Equals(Resources.CloudExplorerLaunchLogsViewerMenuHeader));

            logsMenuItem.Command.Execute(null);

            StringAssert.Contains(filter, "resource.type=\"gae_app\"");
            StringAssert.Contains(filter, "resource.labels.module_id=\"ServiceId\"");
            StringAssert.Contains(filter, "resource.labels.version_id=\"VersionId\"");
        }
Exemple #2
0
        public ActionResult Email(string number, VersionEmailViewModel model)
        {
            var company = new CompanyService(model.CompanyId).GetCompany();
            var version = company.FindVersion(number);

            if (version == null)
            {
                return(HttpNotFound());
            }
            model.Version = version;

            if (ModelState.IsValid)
            {
                try
                {
                    var appName = company.Application.AppName ?? company.CompanyName;
                    var subject = appName + " version " + version.Number;
                    var body    = this.RenderPartialViewToString("_Email", VersionViewModel.CreateFrom(company, version));
                    WebMail.Send(model.RecipientEmailAddress, subject, body);

                    return(RedirectToAction("Index", "Home"));
                }
                catch (Exception e)
                {
                    return(View(model));
                }
            }
            return(View(model));
        }
Exemple #3
0
        public IActionResult GetVersion()
        {
            VersionViewModel version = new VersionViewModel();

            string json = HttpResponse.Success(version);

            return(Ok(json));
        }
        public object Execute(VersionArgs args)
        {
            var model = new VersionViewModel
            {
                Version = "2.4.2"
            };

            return(View("Version", model));
        }
Exemple #5
0
        public object Execute(VersionArgs args)
        {
            var model = new VersionViewModel
            {
                Version = Assembly.GetExecutingAssembly().GetName().Version.ToString()
            };

            return(View("Version", model));
        }
 static void HandleVersionPoint(IApplicationBuilder app)
 => app.Run(async context =>
 {
     var version = new VersionViewModel()
     {
         Version = _version
     };
     context.Response.ContentType = "application/json; charset=utf-8";
     await context.Response.WriteAsync(JsonSerializer.Serialize(version, SerializeOptions));
 });
Exemple #7
0
        public ActionResult Delete(VersionViewModel model)
        {
            var userid = (long)Session["userid"];
            ResponResultViewModel result = VersionRepo.Delete(model, userid);

            return(Json(new
            {
                success = result.Success,
                message = result.Message,
                entity = result.Entity
            }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult AddVersion(Guid productId, string error = null)
        {
            if (error != null)
            {
                ModelState.AddModelError("", error);
            }

            var model = new VersionViewModel {
                ProductId = productId
            };

            return(View(model));
        }
Exemple #9
0
        //
        // GET: /Admin/Version/

        public ActionResult Index(string id)
        {
            var company = Repository.GetById(id);

            if (company == null)
            {
                return(HttpNotFound());
            }
            return
                (View(
                     company.Versions.Select(x => VersionViewModel.CreateFrom(company, x))
                     .OrderByDescending(x => x.CreatedOn)));
        }
Exemple #10
0
        public ActionResult Detail(string compId, string id)
        {
            var company = new CompanyService(compId).GetCompany();
            var version = company.FindVersionById(id);

            if (version == null)
            {
                return(HttpNotFound());
            }
            var viewModel = VersionViewModel.CreateFrom(company, version);

            return(View(viewModel));
        }
 public void AddNewVersionViewModel(VersionViewModel vvm)
 {
     CurrentVersionViewModel.Add(vvm);
     vvm.PropertyChanged += new PropertyChangedEventHandler(
         (obj, propEventArgs) =>
     {
         if (propEventArgs.PropertyName == "IsChecked")
         {
             // CheckedVersions change logic according to the new value (this is just the concept)
             CheckedVersions += (obj as VersionViewModel).IsChecked;
         }
     }
         );
 }
Exemple #12
0
        public void AddVersion(VersionViewModel version)
        {
            if(Versions.Any(a=>a.Id == version.Id))return;
            Versions.Add(version);

            if (Version < version.Number)
            {
                Version = version.Number;
                foreach (var versionViewModel in Versions)
                {
                    versionViewModel.IsLatest = versionViewModel == version;
                }
            }
        }
        public void TestOnStartVersionAsync()
        {
            const string versionId = "VersionId";
            const string serviceId = "ServiceId";
            var          service   = new Service
            {
                Id = serviceId, Split = new TrafficSplit {
                    Allocations = new Dictionary <string, double?>()
                }
            };
            var version = new Version {
                Id = versionId, ServingStatus = GaeVersionExtensions.StoppedStatus
            };
            var ownerMock = new Mock <IGaeSourceRootViewModel> {
                DefaultValueProvider = DefaultValueProvider.Mock
            };

            ownerMock.Setup(
                o => o.DataSource.UpdateVersionServingStatus(
                    GaeVersionExtensions.ServingStatus,
                    serviceId,
                    versionId))
            .Returns(Task.CompletedTask);
            ownerMock.Setup(o => o.InvalidateServiceAsync(serviceId)).Returns(Task.CompletedTask);
            var objectUnderTest = new VersionViewModel(
                ownerMock.Object,
                service,
                version,
                true);

            objectUnderTest.Children.Add(null);

            ICommand onStartVersion = objectUnderTest.ContextMenu
                                      .ItemsSource.OfType <MenuItem>()
                                      .Single(mi => (string)mi.Header == Resources.CloudExplorerGaeStartVersion)
                                      .Command;

            onStartVersion.Execute(null);

            Assert.IsTrue(objectUnderTest.IsLoading);
            Assert.AreEqual(0, objectUnderTest.Children.Count);
            ownerMock.Verify(
                o => o.DataSource.UpdateVersionServingStatus(
                    GaeVersionExtensions.ServingStatus,
                    serviceId,
                    versionId),
                Times.Once);
            ownerMock.Verify(o => o.InvalidateServiceAsync(serviceId), Times.Once);
        }
Exemple #14
0
 public ActionResult Details(int id)
 {
     try
     {
         var version   = _db.Versions.Single(v => v.VrId == id);
         var viewModel = new VersionViewModel();
         viewModel.Version     = version;
         viewModel.ReleaseDate = version.ReleaseDate.ToString("d", CultureInfo.CreateSpecificCulture("de-DE"));
         return(View(viewModel));
     }
     catch (Exception)
     {
         return(HandleError404());
     }
 }
        public InstanceViewModel(VersionViewModel owner, Instance instance)
        {
            _owner = owner;
            _instance = instance;
            root = _owner.root;

            Caption = _instance.VmName;
            UpdateIcon();

            var menuItems = new List<MenuItem>
            {
                new MenuItem { Header = Resources.UiPropertiesMenuHeader, Command = new ProtectedCommand(OnPropertiesWindowCommand) },
            };
            ContextMenu = new ContextMenu { ItemsSource = menuItems };
        }
Exemple #16
0
        //
        // GET: /Admin/Version/Delete/5

        public ActionResult Delete(string id, string number)
        {
            var company = Repository.GetById(id);

            if (company == null)
            {
                return(HttpNotFound());
            }
            var version = company.FindVersion(number);

            if (version == null)
            {
                return(HttpNotFound());
            }
            return(View(VersionViewModel.CreateFrom(company, version)));
        }
        public VersionViewModel Get([FromUri] string system)
        {
            var version = new VersionViewModel
            {
                version     = _dbContext.SysConfig.First(obj => obj.ConfigType == "Version" && obj.ConfigName == system).ConfigValue.Trim(),
                versionCode = int.Parse(_dbContext.SysConfig.First(obj => obj.ConfigType == "VersionCode" && obj.ConfigName == system).ConfigValue.Trim()),
                description = _dbContext.SysConfig.First(obj => obj.ConfigType == "VersionDescription" && obj.ConfigName == system).ConfigValue.Trim(),
            };

            if (system == "Android")
            {
                version.VersionUrl =
                    _dbContext.SysConfig.First(obj => obj.ConfigType == "VersionUrl" && obj.ConfigName == system)
                    .ConfigValue.Trim();
            }
            return(version);
        }
Exemple #18
0
        void DTimerUploadProcess_Tick(object sender, EventArgs e)
        {
            //Condicionar catsync
            if (!UploadProcessViewModel.IsRunning)
            {
                if (VersionViewModel.NewVersion())
                {
                    if (System.Windows.MessageBox.Show("Se detectó una nueva actualización de la aplicación, desea actualizar ahora?", "Actualización automática", System.Windows.MessageBoxButton.YesNo) == System.Windows.MessageBoxResult.Yes)
                    {
                        this.actualiceAPP();
                    }
                }
                UploadProcessViewModel vm = new UploadProcessViewModel();
                vm.PropertyChanged += delegate(object sndr, PropertyChangedEventArgs args)
                {
                    if (args.PropertyName.ToLower() == "jobdone")
                    {
                        if (!((UploadProcessViewModel)sndr).JobDone)
                        {
                            Action a = () => this.ShowImgSync();
                            this.Dispatcher.BeginInvoke(a);
                        }
                        else
                        {
                            Action a = () => this.HideImgSync();
                            this.Dispatcher.BeginInvoke(a);
                        }
                    }

                    if (args.PropertyName.ToLower() == "message")
                    {
                        Action a = () => this.SetImgSyncMsg(((UploadProcessViewModel)sndr).Message);
                        this.Dispatcher.BeginInvoke(a);
                    }
                };
                //DlgUpload ds = new DlgUpload();
                //ds.DataContext = vm;
                //ds.Owner = Application.Current.Windows[0];
                //ds.ShowDialog();
                vm.start();
            }
            else
            {
                VersionViewModel.IsRunning = false;
            }
        }
Exemple #19
0
        //GET FROM VIEW
        public static long GetLastVersionId()
        {
            VersionViewModel result = new VersionViewModel();

            using (var db = new MinProContext())
            {
                result = (from c in db.t_version
                          where c.is_delete == false
                          orderby c.version descending
                          select new VersionViewModel
                {
                    id = c.id,
                    version = c.version + 1
                }).FirstOrDefault();
            }
            return(result.id);
        }
Exemple #20
0
        public static ResponResultViewModel Create(VersionViewModel entity, long userid)
        {
            //Create n Version + 1
            ResponResultViewModel result = new ResponResultViewModel();

            try
            {
                using (var db = new MinProContext())
                {
                    t_version version = new t_version();

                    version.version = entity.version;

                    version.created_by = userid;
                    version.created_on = DateTime.Now;

                    version.is_delete = false;


                    foreach (var quiz in entity.questions)
                    {
                        t_version_detail vd = new t_version_detail();
                        vd.version_id  = version.id;
                        vd.question_id = quiz.id;

                        vd.created_by = userid;
                        vd.created_on = DateTime.Now;

                        db.t_version_detail.Add(vd);
                    }

                    db.t_version.Add(version);
                    db.SaveChanges();



                    result.Entity = entity;
                }
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Message = ex.Message;
            }
            return(result);
        }
        public void TestOnMigrateTrafficCommandAsync()
        {
            const string versionId = "VersionId";
            const string serviceId = "ServiceId";
            var          service   = new Service
            {
                Id    = serviceId,
                Split = new TrafficSplit {
                    Allocations = new Dictionary <string, double?> {
                        [versionId] = .5
                    }
                }
            };
            var version = new Version {
                Id = versionId, ServingStatus = GaeVersionExtensions.ServingStatus
            };
            var ownerMock = new Mock <IGaeSourceRootViewModel> {
                DefaultValueProvider = DefaultValueProvider.Mock
            };

            ownerMock.Setup(o => o.DataSource.UpdateServiceTrafficSplitAsync(It.IsAny <TrafficSplit>(), serviceId))
            .Returns(Task.CompletedTask);
            ownerMock.Setup(o => o.InvalidateServiceAsync(serviceId)).Returns(Task.CompletedTask);
            var objectUnderTest = new VersionViewModel(
                ownerMock.Object,
                service,
                version,
                true);

            ICommand onMigrateTrafficCommand = objectUnderTest.ContextMenu
                                               .ItemsSource.OfType <MenuItem>()
                                               .Single(mi => (string)mi.Header == Resources.CloudExplorerGaeMigrateAllTrafficHeader)
                                               .Command;

            onMigrateTrafficCommand.Execute(null);

            Assert.IsTrue(objectUnderTest.IsLoading);
            ownerMock.Verify(
                o => o.DataSource.UpdateServiceTrafficSplitAsync(
                    It.Is <TrafficSplit>(ts => Math.Abs(ts.Allocations[versionId].GetValueOrDefault() - 1.0) < .01),
                    serviceId),
                Times.Once);
            ownerMock.Verify(o => o.InvalidateServiceAsync(serviceId), Times.Once);
        }
        public void TestOnDeleteVersionAsync()
        {
            const string versionId = "VersionId";
            const string serviceId = "ServiceId";
            var          service   = new Service
            {
                Id = serviceId, Split = new TrafficSplit {
                    Allocations = new Dictionary <string, double?>()
                }
            };
            var version = new Version {
                Id = versionId, ServingStatus = GaeVersionExtensions.ServingStatus
            };
            var ownerMock = new Mock <IGaeSourceRootViewModel> {
                DefaultValueProvider = DefaultValueProvider.Mock
            };
            var objectUnderTest = new VersionViewModel(
                ownerMock.Object,
                service,
                version,
                false);

            PackageMock.Setup(
                p => p.UserPromptService.ActionPrompt(
                    It.IsAny <string>(),
                    It.IsAny <string>(),
                    It.IsAny <string>(),
                    It.IsAny <string>(),
                    It.IsAny <string>(),
                    It.IsAny <bool>()))
            .Returns(true);
            ownerMock.Setup(o => o.DataSource.DeleteVersionAsync(serviceId, versionId)).Returns(Task.CompletedTask);
            ownerMock.Setup(o => o.InvalidateServiceAsync(serviceId)).Returns(Task.CompletedTask);

            objectUnderTest.ContextMenu
            .ItemsSource.OfType <MenuItem>()
            .Single(mi => (string)mi.Header == Resources.CloudExplorerGaeDeleteVersion)
            .Command.Execute(null);

            Assert.IsTrue(objectUnderTest.IsLoading);
            ownerMock.Verify(o => o.DataSource.DeleteVersionAsync(serviceId, versionId), Times.Once);
            ownerMock.Verify(o => o.InvalidateServiceAsync(serviceId), Times.Once);
        }
        public ActionResult AddVersion(VersionViewModel version)
        {
            string error = null;

            if (TryValidateModel(version))
            {
                Product product = _productRepository.Find(version.ProductId);
                product.Versions.Add(new Version {
                    Name = version.Name, IamRole = version.IamRole
                });
                _productRepository.Update(product);
            }
            else
            {
                error = ModelState.SelectMany(x => x.Value.Errors).First().ErrorMessage;
            }

            return(RedirectToAction("Index", new { productId = version.ProductId, error }));
        }
        public void TestOnOpenOnCloudConsoleCommand()
        {
            const string versionId          = "VersionId";
            const string serviceId          = "ServiceId";
            const string projectId          = "ProjectId";
            var          browserServiceMock = new Mock <IBrowserService>();

            PackageMock.Setup(p => p.GetMefServiceLazy <IBrowserService>()).Returns(browserServiceMock.ToLazy());
            var service = new Service
            {
                Id = serviceId, Split = new TrafficSplit {
                    Allocations = new Dictionary <string, double?>()
                }
            };
            var version = new Version {
                Id = versionId, ServingStatus = GaeVersionExtensions.ServingStatus
            };
            var ownerMock = new Mock <IGaeSourceRootViewModel> {
                DefaultValueProvider = DefaultValueProvider.Mock
            };
            var objectUnderTest = new VersionViewModel(
                ownerMock.Object,
                service,
                version,
                false);

            ownerMock.Setup(o => o.Context.CurrentProject).Returns(new Project {
                ProjectId = projectId
            });
            objectUnderTest.ContextMenu
            .ItemsSource.OfType <MenuItem>()
            .Single(mi => (string)mi.Header == Resources.UiOpenOnCloudConsoleMenuHeader)
            .Command.Execute(null);

            browserServiceMock.Verify(
                b => b.OpenBrowser(
                    It.Is <string>(
                        s => s.StartsWith(VersionViewModel.CloudConsoleServiceInstanceUrl, StringComparison.Ordinal) &&
                        s.Contains(versionId) &&
                        s.Contains(serviceId) &&
                        s.Contains(projectId))));
        }
        public void TestUpdateServingStatusAsync_OnError(Exception e, string expectedCaption)
        {
            const string versionId = "VersionId";
            const string serviceId = "ServiceId";
            var          service   = new Service
            {
                Id = serviceId, Split = new TrafficSplit {
                    Allocations = new Dictionary <string, double?>()
                }
            };
            var version = new Version {
                Id = versionId, ServingStatus = GaeVersionExtensions.ServingStatus
            };
            var ownerMock = new Mock <IGaeSourceRootViewModel> {
                DefaultValueProvider = DefaultValueProvider.Mock
            };
            var objectUnderTest = new VersionViewModel(
                ownerMock.Object,
                service,
                version,
                true);

            ownerMock.Setup(
                o => o.DataSource.UpdateVersionServingStatus(
                    GaeVersionExtensions.StoppedStatus,
                    serviceId,
                    versionId))
            .Returns(Task.FromException(e));

            ICommand onStartVersion = objectUnderTest.ContextMenu
                                      .ItemsSource.OfType <MenuItem>()
                                      .Single(mi => (string)mi.Header == Resources.CloudExplorerGaeStopVersion)
                                      .Command;

            onStartVersion.Execute(null);


            Assert.IsFalse(objectUnderTest.IsLoading);
            Assert.IsTrue(objectUnderTest.IsError);
            Assert.AreEqual(expectedCaption, objectUnderTest.Caption);
        }
Exemple #26
0
        public static VersionViewModel GetCurrentVersion()
        {
            VersionViewModel result = new VersionViewModel();

            using (var db = new MinProContext())
            {
                result = (from c in db.t_version
                          where c.is_delete == false
                          orderby c.version descending
                          select new VersionViewModel
                {
                    id = c.id,
                    version = c.version
                }).FirstOrDefault();
                if (result == null)
                {
                    result = new VersionViewModel();
                }
            }
            return(result);
        }
Exemple #27
0
        public ActionResult VersionInformation()
        {
            var viewModel = new VersionViewModel(typeof(MvcApplication).Assembly);

            try
            {
                var amiServerInformation  = new ServerInformationViewModel(this.amiServerInformationService.GetServerInformation(), amiServerInformationService.Name);
                var imsiServerInformation = new ServerInformationViewModel(this.imsiServerInformationService.GetServerInformation(), imsiServerInformationService.Name);

                viewModel.ServerInformation.Add(amiServerInformation);
                viewModel.ServerInformation.Add(imsiServerInformation);

                viewModel.Assemblies.AddRange(AppDomain.CurrentDomain.GetAssemblies().Select(a => new AssemblyInfoViewModel(a)).Where(a => a.Title != null).OrderBy(a => a.Title));
            }
            catch (Exception e)
            {
                Trace.TraceError($"Unable to retrieve version information: {e}");
            }

            return(View(viewModel));
        }
Exemple #28
0
        //
        // GET: /Admin/Version/Create
        public ActionResult Add(int id)
        {
            var currentUser   = _db.Users.Single(u => u.EMail == User.Identity.Name);
            var currentModule = _db.Modules.Single(m => m.ModId == id);

            var model = new Version();

            model.EmId   = currentUser.UId;
            model.User   = currentUser;
            model.ModId  = id;
            model.Module = currentModule;

            try
            {
                var lastVersion =
                    currentModule.Versions.OrderByDescending(v => v.Release + v.SubRelease + v.BuildId).First();
                model.Release    = lastVersion.Release;
                model.SubRelease = lastVersion.SubRelease;
                model.BuildId    = lastVersion.BuildId;
            }
            catch (Exception)
            {
                model.Release    = 0;
                model.SubRelease = 0;
                model.BuildId    = "1";
            }

            model.ReleaseDate = DateTime.Now;

            var viewModel = new VersionViewModel
            {
                Version     = model,
                ReleaseDate =
                    model.ReleaseDate.ToString("d", CultureInfo.CreateSpecificCulture("de-DE"))
            };

            return(View(viewModel));
        }
        public ActionResult Version()
        {
            if (string.IsNullOrWhiteSpace(_pluginVersion))
            {
                var pluginAssembly    = typeof(SwedbankPay.Episerver.Checkout.SwedbankPayCheckoutService).Assembly;
                var pluginVersionInfo = FileVersionInfo.GetVersionInfo(pluginAssembly.Location);
                _pluginVersion = pluginVersionInfo.ProductVersion;
            }

            if (string.IsNullOrWhiteSpace(_sdkVersion))
            {
                var sdkAssembly    = typeof(SwedbankPay.Sdk.SwedbankPayClient).Assembly;
                var sdkVersionInfo = FileVersionInfo.GetVersionInfo(sdkAssembly.Location);
                _sdkVersion = sdkVersionInfo.ProductVersion;
            }

            var versionViewModel = new VersionViewModel
            {
                SdkVersion    = _sdkVersion,
                PluginVersion = _pluginVersion
            };

            return(PartialView(versionViewModel));
        }
Exemple #30
0
        public static ResponResultViewModel Delete(VersionViewModel entity, long userid)
        {
            //Delete Version
            ResponResultViewModel result = new ResponResultViewModel();

            try
            {
                using (var db = new MinProContext())
                {
                    t_version version = db.t_version.Where(o => o.id == entity.id).FirstOrDefault();
                    if (version != null)
                    {
                        version.version    = entity.version;
                        version.deleted_by = userid;
                        version.deleted_on = DateTime.Now;

                        version.is_delete = true;

                        db.SaveChanges();

                        result.Entity = entity;
                    }
                    else
                    {
                        result.Success = false;
                        result.Message = "Version not Found!";
                    }
                }
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Message = ex.Message;
            }
            return(result);
        }
        public void TestOnOpenVersion()
        {
            const string versionId          = "VersionId";
            const string serviceId          = "ServiceId";
            const string versionUrl         = "VersionUrl";
            var          browserServiceMock = new Mock <IBrowserService>();

            PackageMock.Setup(p => p.GetMefServiceLazy <IBrowserService>()).Returns(browserServiceMock.ToLazy());
            var service = new Service
            {
                Id = serviceId, Split = new TrafficSplit {
                    Allocations = new Dictionary <string, double?>()
                }
            };
            var version = new Version
            {
                Id            = versionId,
                ServingStatus = GaeVersionExtensions.ServingStatus,
                VersionUrl    = versionUrl
            };
            var ownerMock = new Mock <IGaeSourceRootViewModel> {
                DefaultValueProvider = DefaultValueProvider.Mock
            };
            var objectUnderTest = new VersionViewModel(
                ownerMock.Object,
                service,
                version,
                false);

            objectUnderTest.ContextMenu
            .ItemsSource.OfType <MenuItem>()
            .Single(mi => (string)mi.Header == Resources.CloudExplorerGaeVersionOpen)
            .Command.Execute(null);

            browserServiceMock.Verify(b => b.OpenBrowser(versionUrl));
        }
        public ActionResult VersionCompare()
        {
            int v1 = int.Parse(Request["v1"]);
            int v2 = int.Parse(Request["v2"]);
            FileBusinessLayer fbl = new FileBusinessLayer();
            FileDB            f1  = fbl.GetFile(v1);
            FileDB            f2  = fbl.GetFile(v2);

            FileStream   fs1      = new FileStream(Path.Combine(_uploadsFolder, f1.FilePath), FileMode.Open);
            FileStream   fs2      = new FileStream(Path.Combine(_uploadsFolder, f2.FilePath), FileMode.Open);
            StreamReader sr1      = new StreamReader(fs1);
            StreamReader sr2      = new StreamReader(fs2);
            string       content1 = sr1.ReadLine();

            while (content1.Trim() == null || content1.Trim().Equals(""))
            {
                content1 = sr1.ReadLine();
            }

            string content2 = sr2.ReadLine();

            while (content2.Trim() == null || content2.Trim().Equals(""))
            {
                content2 = sr2.ReadLine();
            }

            string DiffContent = "\n";
            int    line        = 1;

            while (!sr1.EndOfStream || !sr2.EndOfStream)
            {
                System.Diagnostics.Debug.Write(content1);
                System.Diagnostics.Debug.Write(content2);

                if (sr1.EndOfStream)
                {
                    DiffContent += "In Line No." + line + ": " + "\n"
                                   + "         Version" + f1.Version + ": " + "File End." + "\n"
                                   + "         Version" + f2.Version + ": " + content2 + "\n\n";
                }
                else if (sr2.EndOfStream)
                {
                    DiffContent += "In Line No." + line + ": " + "\n"
                                   + "         Version" + f1.Version + ": " + content1 + "\n"
                                   + "         Version" + f2.Version + ": " + "File End." + "\n\n";
                }
                else if (!content1.Equals(content2))
                {
                    DiffContent += "In Line No." + line + ": " + "\n"
                                   + "         Version" + f1.Version + ": " + content1 + "\n"
                                   + "         Version" + f2.Version + ": " + content2 + "\n\n";
                }

                if (!sr1.EndOfStream)
                {
                    content1 = sr1.ReadLine();
                }
                if (!sr2.EndOfStream)
                {
                    content2 = sr2.ReadLine();
                }
                line++;
            }

            sr1.Close();
            sr2.Close();
            fs1.Close();
            fs2.Close();

            VersionViewModel vvm = new VersionViewModel();

            vvm.FirstVersion  = f1;
            vvm.SecondVersion = f2;
            vvm.DiffContent   = DiffContent;

            return(View("Versions", vvm));
        }