예제 #1
0
 public Object Write(StringValues value)
 {
     if (value.Count == 0)
     {
         return(null);
     }
     else if (value.Count == 1)
     {
         return(Encoding.GetBytes(value[0]));
     }
     else
     {
         return(WriteString(String.Join(Separator, value.AsEnumerable())));
     }
 }
예제 #2
0
        private async Task <Map> LinkNewMapToNote(StringValues noteValues, Map map)
        {
            string currentUser  = User.FindFirstValue(ClaimTypes.NameIdentifier);
            string noteIdString = noteValues.AsEnumerable().First();
            bool   parseNoteId  = int.TryParse(noteIdString, out int noteId);

            if (parseNoteId)
            {
                SessionNote noteToLink = await _context.SessionNotes.FindAsync(noteId);

                if (noteToLink.UserId == currentUser)
                {
                    map.SessionNoteID = noteToLink.SessionNoteID;
                }
            }

            return(map);
        }