public ActionResult Search(int OrderType, string SearchType, string TextCriteria, string StartDateCrit, string EndDateCrit) { var model = new FileTypeModel(); model.FileTypes = GetSelectListItems(); DateTime min = ConvertDateString(StartDateCrit); DateTime max = ConvertDateString(EndDateCrit); if (max < min) { DateTime temp = min; min = max; max = temp; } if (SearchType == "name") { ViewBag.fileObjects = NameSearch(TextCriteria, OrderType); } else if (SearchType == "date") { ViewBag.fileObjects = DateSearch(min, max, OrderType); } return(View("Index", model)); }
public ActionResult PublicSearch(int puOrderType, string puSearchType, string puTextCriteria, string puStartDateCrit, string puEndDateCrit) { var model = new FileTypeModel(); model.FileTypes = GetSelectListItems(); DateTime min = ConvertDateString(puStartDateCrit); DateTime max = ConvertDateString(puEndDateCrit); if (max < min) { DateTime temp = min; min = max; max = temp; } if (puSearchType == "name") { ViewBag.publicFiles = PublicNameSearch(puTextCriteria, puOrderType); } else if (puSearchType == "date") { ViewBag.publicFiles = PublicDateSearch(min, max, puOrderType); } ViewBag.privateFiles = PrivateDateSearch(DateTime.MinValue, DateTime.MaxValue, (int)OrderingOption.NewestFirst); return(View("Index", model)); }
/// <summary> /// The Index controller action is the default action called when the UserContent page is /// browsed to. /// </summary> /// <returns> /// A view to the "Index.cshtml" page in the Views/PublicContent/ folder. /// </returns> public ActionResult Index() { var model = new FileTypeModel(); ViewBag.fileObjects = DateSearch(DateTime.MinValue, DateTime.MaxValue, (int)OrderingOption.NewestFirst); // Create a list of SelectListItems so these can be rendered on the page model.FileTypes = GetSelectListItems(); return(View("Index", model)); }
public ActionResult PrivateContentSelect(FileTypeModel model, string downloadType) { if (model.FileType != null || downloadType.LastIndexOf("--Delete") >= 0) { int index = downloadType.LastIndexOf("--"); string filename = downloadType.Substring(0, index) + ".fbx"; string selectionType = downloadType.Substring(index + 2); BlobManager blobManager = new BlobManager(); if (selectionType == "Download") { string downloadLink = blobManager.ConvertAndDownloadBlobFromUserContainer(User.Identity.Name, filename, model.FileType, Server.MapPath("~/UploadedFiles")); Response.Redirect(downloadLink); } else if (selectionType == "GeneralQR") { string downloadLink = blobManager.ConvertAndDownloadBlobFromUserContainer(User.Identity.Name, filename, model.FileType, Server.MapPath("~/UploadedFiles")); ViewBag.FileName = filename.Substring(0, filename.Length - 4) + model.FileType; return(DisplayQRCode(downloadLink)); } else if (selectionType == "MobileQR") { CloudBlobContainer container = blobManager.GetOrCreateBlobContainer(User.Identity.Name); CloudBlockBlob blob = container.GetBlockBlobReference(filename); string mobileLink = string.Empty; if (blob.Exists()) { mobileLink = blob.Uri.ToString(); } ViewBag.FileName = filename.Substring(0, filename.Length - 4) + model.FileType; return(DisplayQRCode(mobileLink)); } else if (selectionType == "Delete") { bool deleted = blobManager.DeleteBlobByNameInUserContainer(User.Identity.Name, filename); return(Index()); } return(View()); } else { ViewBag.Invalid = true; return(Index()); } }