/// <summary> /// This file create the file using base 64 string /// </summary> /// <param name="gItem"></param> /// <returns></returns> private bool CreateFileFromBase64String(GalleryItem gItem) { try { // Get the document path and creating directory var galleryLocation = ConfigurationManager.AppSettings["appDocPath"] + "\\gallery\\"; if (!Directory.Exists(galleryLocation)) Directory.CreateDirectory(galleryLocation); galleryLocation = galleryLocation + gItem.FileName; //check for same file galleryLocation = new Documents().GetFileName(galleryLocation); gItem.FileName = Path.GetFileName(galleryLocation); File.WriteAllBytes(galleryLocation, Convert.FromBase64String(gItem.Base64)); } catch (Exception) { return false; } return true; }
public IEnumerable<Document> GetClientDocuments([FromUri] int clientId) { //get client document types var clientDocTypes = new Documents().GetDocumentTypesForPrimaryTypes("client").Select(t => t.DocTypeValue).ToArray(); return Documents.GetDocumentByDocType(clientDocTypes, clientId); }