public TaskTypeEntity Update (TaskTypeEntity entity)
		{
			try
            {
                _tasktypeRepository.Update(entity);
                return entity;
            }
            catch (Exception e)
            {
				_log.Error(e,"数据库操作出错");
                return null;
            }
		}
		public bool Delete(TaskTypeEntity entity)
		{
			try
            {
                _tasktypeRepository.Delete(entity);
                return true;
            }
            catch (Exception e)
            {
				_log.Error(e,"数据库操作出错");
                return false;
            }
		}
        public HttpResponseMessage AddTaskTpye([FromBody]TaskTypeModel taskTypeModel)
        {
            if (!string.IsNullOrWhiteSpace(taskTypeModel.Name))
            {
                Regex reg = new Regex(@"^[^ %@#!*~&',;=?$\x22]+$");
                var m = reg.IsMatch(taskTypeModel.Name);
                if (!m)
                {
                    return PageHelper.toJson(PageHelper.ReturnValue(false, "类型名称存在非法字符!"));
                }
                if (taskTypeModel.Describe != "")
                {
                    var m1 = reg.IsMatch(taskTypeModel.Describe);

                    if (!m1)
                    {
                        return PageHelper.toJson(PageHelper.ReturnValue(false, "描述存在非法字符!"));
                    }
                }
                var model = new TaskTypeEntity
                {
                    Id = taskTypeModel.Id,
                    Name = taskTypeModel.Name,
                    Describe = taskTypeModel.Describe
                };
                var mo1 = new TaskTypeSearchCondition
             {
                 NameRe = taskTypeModel.Name
             };

                if (taskTypeModel.Type == "add")
                {
                    int taskTypeCount = _taskTypeService.GetTaskTypeCount(mo1);
                    if (taskTypeCount > 0)
                    { return PageHelper.toJson(PageHelper.ReturnValue(false, "名称重复,请更换")); }
                    else
                    {
                        try
                        {
                            if (_taskTypeService.Create(model) != null)
                            {
                                return PageHelper.toJson(PageHelper.ReturnValue(true, "添加成功"));
                            }
                        }
                        catch (Exception)
                        {
                            return PageHelper.toJson(PageHelper.ReturnValue(false, "添加失败"));
                        }
                    }
                }
                if (taskTypeModel.Type == "edit")
                {
                    try
                    {
                        _taskTypeService.Update(_taskTypeService.GetTaskTypeById(taskTypeModel.Id));
                        return PageHelper.toJson(PageHelper.ReturnValue(true, "修改成功"));
                    }
                    catch (Exception)
                    {
                        return PageHelper.toJson(PageHelper.ReturnValue(false, "修改失败"));
                    }
                }
            }
            return PageHelper.toJson(PageHelper.ReturnValue(false, "类型名称不能为空!"));
        }