Example #1
0
        public OptResult Release(ProcessByIdModel vm)
        {
            OptResult rst = null;

            if (vm == null || string.IsNullOrEmpty(vm.id))
            {
                rst = OptResult.Build(ResultCode.ParamError, "参数不能为空或格式不正确");
                return(rst);
            }

            var task = _rep.GetById(vm.id);

            if (task == null)
            {
                rst = OptResult.Build(ResultCode.DataNotFound, "未找到指定数据", new { id = vm.id });
                return(rst);
            }

            task.issue_time     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            task.state          = "已发布";
            task.complete_state = "未领";

            _rep.Update(task);

            rst = OptResult.Build(ResultCode.Success, "发布成功");
            return(rst);
        }
Example #2
0
        public OptResult Take(ProcessByIdModel vm)
        {
            OptResult rst = null;

            if (vm == null || string.IsNullOrEmpty(vm.id))
            {
                rst = OptResult.Build(ResultCode.ParamError, "参数不能为空或格式不正确");
                return(rst);
            }
            var task = _rep.GetById(vm.id);

            if (task == null)
            {
                rst = OptResult.Build(ResultCode.DataNotFound, "未找到指定任务", new { id = vm.id });
                return(rst);
            }

            task.complete_state = "已领未完成";
            _rep.Update(task);

            rst = OptResult.Build(ResultCode.Success, "任务领取成功");

            return(rst);
        }