Beispiel #1
0
        public async Task <IActionResult> PostLiteralTranslations([FromBody] LiteralTranslations literalTranslations)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.literalTranslations.Add(literalTranslations);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLiteralTranslations", new { id = literalTranslations.LiteralTranslationID }, literalTranslations));
        }
Beispiel #2
0
        public async Task <IActionResult> PutLiteralTranslations([FromRoute] Guid id, [FromBody] LiteralTranslations literalTranslations)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != literalTranslations.LiteralTranslationID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }