Exemplo n.º 1
0
        public async Task <ActionResult <CrewChange> > PostCrewChange(CrewChange crewChange)
        {
            _context.CrewChanges.Add(crewChange);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCrewChange", new { id = crewChange.CrewChangeId }, crewChange));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutCrewChange(int id, CrewChange crewChange)
        {
            if (id != crewChange.CustQuoteMasterId)
            {
                return(BadRequest());
            }

            // _context.Entry(crewChange).State = EntityState.Modified;

            try
            {
                _context.Entry(crewChange).Property(x => x.SignOn).IsModified        = true;
                _context.Entry(crewChange).Property(x => x.SignOff).IsModified       = true;
                _context.Entry(crewChange).Property(x => x.Remarks).IsModified       = true;
                _context.Entry(crewChange).Property(x => x.LastUpdatedBy).IsModified = true;
                _context.Entry(crewChange).Property(x => x.LastUpdatedDt).IsModified = true;
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CrewChangeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }