예제 #1
0
        public async Task <ActionResult <WalkByInspection> > PostWalkByInspection(WalkByInspection walkByInspection)
        {
            _context.WalkByInspections.Add(walkByInspection);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetWalkByInspection", new { id = walkByInspection.Id }, walkByInspection));
        }
예제 #2
0
        public async Task <IActionResult> PutWalkByInspection(Guid id, WalkByInspection walkByInspection)
        {
            if (id != walkByInspection.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WalkByInspectionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    return(StatusCode(StatusCodes.Status500InternalServerError));
                }
            }

            return(NoContent());
        }