public IActionResult UpdateTask([FromBody] Task t) { if (_service.UpdateTask(t)) { return(Ok(t)); } else { return(BadRequest("there error")); } }
public IActionResult AddTask([FromBody] GetTask t) { Task task = new Task(); task.EventName = t.EventName; task.EndDate = t.EndDate; task.StartDate = t.StartDate; task.Status = t.Status; task.TaskName = t.TaskName; task.Description = t.Description; task.BudgetedCost = t.BudgetedCost; task.AddDate = t.AddDate; int taskid = _service.AddTask(task); if (taskid != 0) { EmployeeTask eTask = new EmployeeTask(); //eTask.EmpId = t.Employees[0]; int x = 0; foreach (var i in t.Employees) { // int x = Int32.Parse(i); eTask.EId = t.Employees[x]; eTask.TaskId = taskid; _service.AddEmployeeTask(eTask); x++; } return(Ok(t)); } else { return(BadRequest("error")); } }