示例#1
0
        //更新
        // PUT api/tasks
        public void Put([FromBody] TaskMiniBackend.Models.Task task)
        {
            if (task == null)
            {
                return;
            }

            this.Dao.Update <TaskMiniBackend.Models.Task>(task);
        }
示例#2
0
        //取得
        // GET api/tasks/id
        public TaskMiniBackend.Models.Task Get(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(null);
            }

            TaskMiniBackend.Models.Task task = null;

            task = this.Dao.Read <TaskMiniBackend.Models.Task>().SingleOrDefault(t => t.Id == id);

            return(task);
        }
示例#3
0
        //新規登録
        // POST api/tasks
        public void Post([FromBody] TaskMiniBackend.Models.Task task)
        {
            if (task == null)
            {
                return;
            }

            var lastTask = this.Dao.Read <Task>().OrderByDescending(t => t.Order).FirstOrDefault();

            if (lastTask != null)
            {
                task.Order = lastTask.Order + 1;
            }

            this.Dao.Create <TaskMiniBackend.Models.Task>(task);
        }