public JsonResult Add(MSI_RecallForm _recallform) { MSIRecallFormRepository repository; _recallform.IsActive = true; try { repository = new MSIRecallFormRepository(); if (_recallform.ID > 0) { repository.Update(_recallform); } else { repository.Add(_recallform); } } catch (Exception ex) { } //return _dpsform; return Json(_recallform, JsonRequestBehavior.AllowGet); }
public bool PerformFileUploadOperation(MSI_RecallForm _recallForm, IEnumerable<HttpPostedFileBase> FilesCollection) { Cascade.Data.Repositories.MSIRecallFormRepository repository = new MSIRecallFormRepository(); string _allMediaDocuments = ""; //set document name if we already have one and already uploaded in the past _allMediaDocuments = (_recallForm.CheckDocuments == null) ? "" : _recallForm.CheckDocuments; //get GUID string _additionalIdentifier = Guid.NewGuid().ToString(); //Get all fileNames together so store in the Database foreach (var file in FilesCollection) { if (file != null) { if (_allMediaDocuments.Length > 0) { _allMediaDocuments = _allMediaDocuments + "|" + _additionalIdentifier + "_" + file.FileName; } else { _allMediaDocuments = _additionalIdentifier + "_" + file.FileName; } } } //Now Upload and set the properties foreach (var file in FilesCollection) { if (file != null) { if (file.ContentLength > 0) { //Upload the file fileProcessor.SaveUploadedFileWithIdentifier(file, _additionalIdentifier); } } } if (_allMediaDocuments != "") { //Perform Save Operation _recallForm.CheckDocuments = _allMediaDocuments; repository.Update(_recallForm); } //response return true; }