Beispiel #1
0
        public async Task <ActionResult <TimeTrackings> > PostTimeTracking(TimeTrackings timeTracking)
        {
            _context.TimeTrackings.Add(timeTracking);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTimeTracking", new { id = timeTracking.timer_id }, timeTracking));
        }
Beispiel #2
0
        public async Task <IActionResult> PutTimeTracking(int id, TimeTrackings timeTracking)
        {
            if (id != timeTracking.timer_id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }