示例#1
0
        public async Task <ActionResult> Put(int id, [FromBody] TrackerDetails value)
        {
            if (id != value.Id)
            {
                return(BadRequest());
            }

            dbContext.Entry(value).State = EntityState.Modified;

            try
            {
                await dbContext.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TrackerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(NoContent());
        }
示例#2
0
        public async Task <ActionResult <TrackerDetails> > Post([FromBody] TrackerDetails value)
        {
            dbContext.tbTracker.Add(value);
            await dbContext.SaveChangesAsync();

            return(CreatedAtAction("GetTracker", new { id = value.Id }, value));
        }