コード例 #1
0
        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));
        }
コード例 #2
0
        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
            }));
        }
コード例 #3
0
 public ActionResult AddTask(TaskDTO addsTask) //addข้อมุลไปยัง  sql
 {
     TaskService.AddTasks(addsTask);
     return(Ok());
 }