public async Task <AppDevices> Update(AppDevices appdevice) { _context.Update(appdevice); await _context.SaveChangesAsync(); return(appdevice); }
public async Task <ActionResult <AppDevices> > PostAppDevices(AppDevices appDevices) { _context.AppDevices.Add(appDevices); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAppDevices", new { id = appDevices.id }, appDevices)); }
public async Task <IActionResult> PutAppDevices(int id, AppDevices appDevices) { if (id != appDevices.id) { return(BadRequest()); } _context.Entry(appDevices).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppDevicesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <AppDevices> Add(AppDevices appdevice) { await _context.AppDevices.AddAsync(appdevice); await _context.SaveChangesAsync(); return(appdevice); }
public async Task <IActionResult> PostAppDevices([FromBody] AppDevices appDevices) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } await _appDeviceRepository.Add(appDevices); return(CreatedAtAction("GetAppDevices", new { id = appDevices.Id }, appDevices)); }
public async Task <IActionResult> PutAppDevices([FromRoute] int id, [FromBody] AppDevices appDevices) { await _appDeviceRepository.Update(appDevices); return(Ok(appDevices)); }
public HomeController() { _appDevices = new AppDevices(); }