示例#1
0
        public async Task <IActionResult> PutTmaxTrainCurrentValidFor(byte id, TmaxTrainCurrentValidFor tmaxTrainCurrentValidFor)
        {
            if (id != tmaxTrainCurrentValidFor.TmaxTrainCurrentValidForId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <ActionResult <TmaxTrainCurrentValidFor> > PostTmaxTrainCurrentValidFor(TmaxTrainCurrentValidFor tmaxTrainCurrentValidFor)
        {
            _context.TmaxTrainCurrentValidFor.Add(tmaxTrainCurrentValidFor);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TmaxTrainCurrentValidForExists(tmaxTrainCurrentValidFor.TmaxTrainCurrentValidForId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTmaxTrainCurrentValidFor", new { id = tmaxTrainCurrentValidFor.TmaxTrainCurrentValidForId }, tmaxTrainCurrentValidFor));
        }