public async Task <IHttpActionResult> CreateAsync(ServerTaskDto task) { _repository.Add(task.Map <ServerTask>()); await _unitOfWork.CompleteAsync(); return(Created(new Uri(Request.RequestUri + "/" + task.Id), task)); }
public async Task <IHttpActionResult> UpdateAsync(int id, ServerTaskDto task) { var taskInDb = await _repository.GetAsync(id); if (taskInDb == null) { return(NotFound()); } _repository.Add(task.Map <ServerTask>()); await _unitOfWork.CompleteAsync(); return(Ok()); }