public ActionResult FindFilePerson(int PersonID, int FileID) { PersonGeneral person = mappingController.personListData.personList.Find(item => item.ID == PersonID); if (person != null) { person.attachFileList.Load(); AttachFilePerson atp = person.attachFileList.Find(item => item.ID == FileID); return(Json(atp)); } return(Json("")); }
public FileResult DownloadFile(int PersonID, int FileID) { PersonGeneral person = mappingController.personListData.personList.Find(item => item.ID == PersonID); if (person != null) { person.attachFileList.Load(); AttachFilePerson atp = person.attachFileList.Find(item => item.ID == FileID); if (atp != null) { byte[] filebytes = System.IO.File.ReadAllBytes(Path.Combine(Server.MapPath("~/App_Data/uploads/data"), atp.guid)); return(File(filebytes, System.Net.Mime.MediaTypeNames.Application.Octet, Path.ChangeExtension(atp.Name, atp.Extension))); } } return(null); }
public ActionResult SaveFilePerson(int PersonID, int FileID, string Description) { PersonGeneral person = mappingController.personListData.personList.Find(item => item.ID == PersonID); if (person != null) { person.attachFileList.Load(); AttachFilePerson atp = person.attachFileList.Find(item => item.ID == FileID); if (atp != null) { atp.Description = Description; atp.Save(); } } return(Json("")); }
public ActionResult DeleteFilePerson(int PersonID, int FileID) { PersonGeneral person = mappingController.personListData.personList.Find(item => item.ID == PersonID); if (person != null) { person.attachFileList.Load(); AttachFilePerson atp = person.attachFileList.Find(item => item.ID == FileID); if (atp != null) { atp.Delete(); controllerUtils.DeleteFile(atp.guid); } } return(Json("")); }
public ActionResult UploadFileToPerson(int PersonID, List <AttachFileTransferData> data) { PersonGeneral person = mappingController.personListData.personList.Find(item => item.ID == PersonID); if ((person != null) && (data != null)) { person.attachFileList.Load(); foreach (var item in data) { AttachFilePerson atp = person.attachFileList.Create(); item.FillData(atp); atp.Save(); } } return(Json("")); }