Exemple #1
0
        public async Task <IActionResult> PutTableConsecutive(Guid id, TableConsecutive tableConsecutive)
        {
            if (id != tableConsecutive.Id)
            {
                return(BadRequest());
            }

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

            ChangeLog.AddUpdatedLog(_context, "TableConsecutives", tableConsecutive);

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <ActionResult <TableConsecutive> > PostTableConsecutive(TableConsecutive tableConsecutive)
        {
            if (tableConsecutive.Prefix != "")
            {
                tableConsecutive.UsesPrefix = true;
            }

            if (tableConsecutive.RangeMin != null || tableConsecutive.RangeMax != null)
            {
                tableConsecutive.UsesRange = true;
            }

            _context.TableConsecutives.Add(tableConsecutive);

            ChangeLog.AddCreatedLog(_context, "TableConsecutives", tableConsecutive);

            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTableConsecutive", new { id = tableConsecutive.Id }, tableConsecutive));
        }