Ejemplo n.º 1
0
        public async Task <ActionResult <HiRailInspection> > PostHiRailInspection(HiRailInspection hiRailInspection)
        {
            _context.HiRailInspections.Add(hiRailInspection);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetHiRailInspection", new { id = hiRailInspection.Id }, hiRailInspection));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutHiRailInspection(Guid id, HiRailInspection hiRailInspection)
        {
            if (id != hiRailInspection.Id)
            {
                return(BadRequest());
            }


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

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

            return(NoContent());
        }