public ActionResult CreateRelease(string[] selectedCompanys) { var parameterInstance = ParameterSingleton.Instance; var nameVersion = $"{parameterInstance.ParameterList.FirstOrDefault(x => x.ParameterInternalIdentificator == ParameterInternalIdentificator.VersionValue).Value}.{DateTime.Now.Year.ToString().Substring(2)}.{DateTime.Now.Month}.{DateTime.Now.DayOfYear}.{DateTime.Now.Hour}"; var path = $"{_directoryPath}/{nameVersion}"; if (!Directory.Exists(path)) { return(RedirectToAction("Index")); } var currentNotesData = Request.Form["Notes"]; if (currentNotesData == null) { throw new Exception("Notes relase was not found"); } if (string.IsNullOrEmpty(currentNotesData) || currentNotesData.Length < Convert.ToInt32(parameterInstance.ParameterList.FirstOrDefault(x => x.ParameterInternalIdentificator == ParameterInternalIdentificator.ValidDaysToken).Value)) { ModelState.AddModelError(string.Empty, @"Ingrese las notas de la versión, al menos " + parameterInstance.ParameterList.FirstOrDefault(x => x.ParameterInternalIdentificator == ParameterInternalIdentificator.ValidDaysToken).Value + " caractéres"); ViewBag.Companys = _companyService.GetAllCompanys(); return(View("Create")); } if (!Directory.Exists($"{path}.zip")) { Compress.CompressFolder($"{path}.zip", path); byte[] releaseContent = System.IO.File.ReadAllBytes($"{path}.zip"); var release = new Release { UserId = User.Id, IsSafe = true, Published = DateTime.Now, Version = nameVersion, Notes = currentNotesData, ReleaseContent = releaseContent }; _releaseService.Create(release); Log.Instance.Info($"Usuario {User.Name} {User.LastName} creo el release {nameVersion}"); if (selectedCompanys != null) { foreach (var company in selectedCompanys) { _companyReleaseService.Save(new ServerRelease { ServerId = new Guid(company), ReleaseId = release.Id }); } } Directory.Delete(_directoryPath, true); } return(RedirectToAction("Index")); }