Exemple #1
0
        public async Task <ActionResult <ScheduleAsset> > PostAsset(ScheduleAsset scheduleAsset)
        {
            _context.ScheduleAsset.Add(scheduleAsset);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAsset", new { id = scheduleAsset.ScheduleAssetID }, scheduleAsset));
        }
Exemple #2
0
        public async Task <IActionResult> PutAsset(int id, ScheduleAsset scheduleAsset)
        {
            if (id != scheduleAsset.ScheduleAssetID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }