public async Task <DBtask> PostTask(DBtask task) { _context.Tasks.Add(task); await _context.SaveChangesAsync(); return(task); }
public async Task <ActionResult <DBtask> > PostDBtask(DBtask dBtask) { if (_taskService.taskExistsByName(dBtask.TaskName)) { return(BadRequest()); } var task = await _taskService.PostTask(dBtask); return(CreatedAtAction("GetDBtask", new { id = dBtask.Id }, task)); }
public async Task <DBtask> UpdateTask(int id, DBtask dBtask) { dBtask.Id = id; _context.Entry(dBtask).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (DBtaskExists(id)) { throw; } } return(await GetTask(id)); }
public async Task <IActionResult> PutDBtask(int id, DBtask dBtask) { var Result = await _taskService.UpdateTask(id, dBtask); return(NoContent()); }