예제 #1
0
 public bool UpdateDataInfo(W_DataInfo test)
 {
     if (test == null)
     {
         throw new ApiException("对象错误");
         //当出现异常后,可以直接抛ApiException,拦截器将会拦截异常,并格式化输出
     }
     return(Orm.Update(test) > 0);
 }
예제 #2
0
 public bool AddDataInfo(W_DataInfo model)
 {
     if (string.IsNullOrEmpty(model.Title))
     {
         throw new ApiException("标题不能为空");
         //当出现异常后,可以直接抛ApiException,拦截器将会拦截异常,并格式化输出
     }
     return(Orm.Insert(model) > 0);
 }
예제 #3
0
        public dynamic DeleteDatainfo(W_DataInfo model)
        {
            DataInfoMapper mapper = new DataInfoMapper();

            if (mapper.DeleteDataInfo(model.ID))
            {
                return(Success("操作成功"));
            }
            else
            {
                return(Success("操作失败"));
            }
        }
예제 #4
0
        public dynamic AddDatainfo(DataInfoModel1 model)
        {
            W_DataInfo newModel = new W_DataInfo();

            if (model != null)
            {
                if (model.BusType == 0)
                {
                    newModel.BusType = 0;
                    newModel.BusID   = model.Course_ID;
                }
                else if (model.BusType == 1)
                {
                    newModel.BusType = 1;
                    newModel.BusID   = model.CourseChapters_ID;
                }
                else if (model.BusType == 2)
                {
                    newModel.BusType = 2;
                    newModel.BusID   = model.CourseUnit_ID;
                }
                newModel.Title             = model.Title;
                newModel.Path              = model.Path;
                newModel.DownCount         = model.DownCount;
                newModel.DataSize          = model.DataSize;
                newModel.DataInfoType      = model.DataInfoType;
                newModel.Content           = model.Content;
                newModel.AddPerson         = this.AccountID;
                newModel.AddTime           = DateTime.Now.ToString();
                newModel.System_Station_ID = this.System_Station_ID;
                DataInfoMapper mapper = new DataInfoMapper();
                var            dict   = mapper.AddDataInfo(newModel);
                if (dict)
                {
                    return(Success("操作成功"));
                }
                else
                {
                    return(Success("操作失败"));
                }
            }
            else
            {
                return(Success("操作失败"));
            }
        }
예제 #5
0
        public dynamic UpdateDatainfo(W_DataInfo model)
        {
            if (model != null)
            {
                model.System_Station_ID = this.System_Station_ID;

                DataInfoMapper mapper = new DataInfoMapper();

                if (mapper.UpdateDataInfo(model))
                {
                    return(Success("操作成功"));
                }
                else
                {
                    return(Success("操作失败"));
                }
            }
            else
            {
                return(Success("操作失败"));
            }
        }