Exemplo 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());
        }
Exemplo 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));
        }
Exemplo n.º 3
0
 public ReadingsString <ReadingTypes> ProcessWithReadings(string text, ReadingTypes readingsToUse)
 => new ReadingsString <ReadingTypes>(text.SplitIntoSurrogatePairs()
Exemplo 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));