public async Task <IActionResult> AddTasks([FromBody] EmployeeTasksResources TasksResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var TaskToAdd = _mapper.Map <EmployeeTasksResources, EmployeeTasks>(TasksResource); _repo.AddTasks(TaskToAdd); await _unitofwork.CompleteAsync(); return(StatusCode(201)); }
public async Task <IActionResult> UpdateTasks(int id, [FromBody] EmployeeTasksResources TaskResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } EmployeeTasks Tasks = await _repo.Get(id); if (Tasks == null) { return(NotFound()); } _mapper.Map(TaskResource, Tasks); await _unitofwork.CompleteAsync(); return(StatusCode(202)); }