Exemple #1
0
        public async Task <IActionResult> PutIncentiveLog([FromRoute] int id, [FromBody] IncentiveLog incentiveLog)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != incentiveLog.IncentiveLogId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> PostIncentiveLog([FromBody] IncentiveLog incentiveLog)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.IncentiveLogs.Add(incentiveLog);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetIncentiveLog", new { id = incentiveLog.IncentiveLogId }, incentiveLog));
        }