public async Task AlterState(int id, string status) { var task = new Models.Task() { Id = id, Status = status, }; switch (status) { case "A": task.DataEdicao = DateTime.Now; task.DataConclusao = null; task.DataRemocao = null; break; case "R": task.DataEdicao = DateTime.Now; task.DataConclusao = null; task.DataRemocao = DateTime.Now; break; case "C": task.DataEdicao = DateTime.Now; task.DataConclusao = DateTime.Now; task.DataRemocao = null; break; default: return; } await _taskRepository.AlterState(task); }