Esempio n. 1
0
        public async Task <IActionResult> PutReadingTypes(string id, ReadingTypes readingTypes)
        {
            if (id != readingTypes.ReadingTypeId)
            {
                return(BadRequest());
            }

            _context.Entry(readingTypes).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ReadingTypesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult <ReadingTypes> > PostReadingTypes(ReadingTypes readingTypes)
        {
            _context.ReadingTypes.Add(readingTypes);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ReadingTypesExists(readingTypes.ReadingTypeId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetReadingTypes", new { id = readingTypes.ReadingTypeId }, readingTypes));
        }
Esempio n. 3
0
 public ReadingsString <ReadingTypes> ProcessWithReadings(string text, ReadingTypes readingsToUse)
 => new ReadingsString <ReadingTypes>(text.SplitIntoSurrogatePairs()
Esempio n. 4
0
 public string Process(string text, ReadingTypes readingsToUse)
 => string.Join("", ProcessWithReadings(text, readingsToUse).Characters
                .Select(c => c.Readings.Length > 0 ? c.Readings[0].Value : c.Character));