public ActionResult Create(CustomerDocumentItemModel customerDocumentItemModel) // !!! { try { if (ValidateModelState(Application.Repository)) { if (customerDocumentItemModel.Upload != null && customerDocumentItemModel.Upload.ContentLength > 0) { ZFileTypes fileType = LibraryHelper.GetFileType(Path.GetExtension(customerDocumentItemModel.Upload.FileName)); string acronym = LibraryHelper.GetAcronym(fileType); customerDocumentItemModel.CustomerDocument.FileAcronym = acronym; CustomerDocumentDTO customerDocumentDTO = (CustomerDocumentDTO)customerDocumentItemModel.CustomerDocument.ToDTO(); if (Application.Create(customerDocumentItemModel.OperationResult, customerDocumentDTO)) { byte[] uploadArray = new byte[customerDocumentItemModel.Upload.ContentLength]; customerDocumentItemModel.Upload.InputStream.Read(uploadArray, 0, uploadArray.Length); IEdmManager edmManager = DependencyResolver.Current.GetService <IEdmManager>(); edmManager.WriteFile("CustomerDocument", customerDocumentDTO.CustomerDocumentId, fileType, uploadArray); return(RedirectToUrlDictionary()); } } } } catch (Exception exception) { customerDocumentItemModel.OperationResult.ParseException(exception); } customerDocumentItemModel.IsSecurityOperations = IsSecurityOperations; return(View(customerDocumentItemModel)); }