public IHttpActionResult Put(int dossierId, int noteId, int id, [FromBody] NoteMedia noteMediaModel) { var dossier = default(DossierData); if (!CurrentUser.TryGetDossier(dossierId, out dossier)) { return(NotFound()); } var note = default(NoteData); if (!dossier.TryGetNote(noteId, out note)) { return(NotFound()); } var media = default(NoteMediaData); if (!note.TryGetMedia(id, out media)) { return(NotFound()); } var filename = StorageHelper.GetFileNameFromSasUri(media.MediaLocation); media.MediaLocation = StorageHelper.GetReadableSasUri(filename, new TimeSpan(0, 2, 0)).AbsoluteUri; //media.MediaLocation = StorageHelper.GetReadableSasUri(filename, new TimeSpan(1, 0, 0)).AbsoluteUri; UoW.Save(); var result = Converter.ToNoteMedia(media); return(Ok(result)); }
public static NoteMedia ToNoteMedia(NoteMediaData noteMedia) { var noteMediaModel = new NoteMedia { Id = noteMedia.Id, Name = noteMedia.Name, Location = noteMedia.MediaLocation }; return(noteMediaModel); }