public async Task <IActionResult> Post([FromBody] TaskDTO model) { TaskModel task = new DTOMapper <TaskDTO, TaskModel>().Serialize(model); var taskid = await _taskService.AddTasks(task); return(Ok(taskid)); }
public JsonResult CreateTasks(TasksViewModel tasksView) { tasksView.SortNameTask = "ChuaNghiRa"; var status = false; if (tasksView.Id == 0) { var models = Mapper.Map <TasksViewModel, Tasks>(tasksView); if (true) { _TasksService.AddTasks(models); _TasksService.SaveChange(); } } else { status = true; } return(Json(new { data = status })); }
public ActionResult AddTask(TaskDTO addsTask) //addข้อมุลไปยัง sql { TaskService.AddTasks(addsTask); return(Ok()); }