コード例 #1
0
 public IHttpActionResult TestUploadCostPhoto()
 {
     try
     {
         int Height = Convert.ToInt32(requestHelper.GetRequsetForm("Height", ""));
         int Weight = Convert.ToInt32(requestHelper.GetRequsetForm("Weight", ""));
         WebApi_BLL.T_Forum_Photo bll = new WebApi_BLL.T_Forum_Photo();
         string Path = HttpContext.Current.Server.MapPath("/Content/User_Photo/");
         //HttpPostedFile file = HttpContext.Current.Request.Files[0];
         //if(file.ContentLength >)
         //string fileExtName = file.FileName.Substring(file.FileName.LastIndexOf("."));
         //string newName = Guid.NewGuid().ToString() + fileExtName;
         //string savePath = Path + newName;
         //file.SaveAs(savePath);
         //WebApi_Model.T_Forum_Photo model = new WebApi_Model.T_Forum_Photo();
         //model.Photo = newName;
         //model.UploadTime = DateTime.Now;
         //model.Height = Height;
         //model.Weight = Weight;
         //int key = bll.Add(model);
         //model.ForumPhotoID = key;
         return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject("Weight:" + Weight + " Height:" + Height + " Length:"))));
     }
     catch (SystemException ex)
     {
         return(Ok(ReturnJsonResult.GetJsonResult(-1, "Error", ex.Message)));
     }
 }
コード例 #2
0
        public IHttpActionResult DeletePhoto()
        {
            int ID = int.Parse(requestHelper.GetRequsetForm("ID", ""));

            WebApi_BLL.T_Forum_Photo bll = new WebApi_BLL.T_Forum_Photo();
            bool flag = bll.Delete(ID);

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", flag)));
        }
コード例 #3
0
        public IHttpActionResult GetTopTen()
        {
            WebApi_BLL.T_Forums          bll   = new WebApi_BLL.T_Forums();
            DataSet                      ds    = bll.GetList(10, "Status =2 and Flag = 1", "ForumID desc");
            List <WebApi_Model.T_Forums> model = bll.DataTableToList(ds.Tables[0]);

            WebApi_BLL.T_Forum_Photo   tfpbll = new WebApi_BLL.T_Forum_Photo();
            WebApi_BLL.T_User_BaseInfo tubll  = new WebApi_BLL.T_User_BaseInfo();

            foreach (WebApi_Model.T_Forums m in model)
            {
                m.Forum_Photo  = tfpbll.GetModelList("ForumID = " + m.ForumID);
                m.UserBaseInfo = tubll.GetModel((int)m.UID);
            }
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(model))));
        }
コード例 #4
0
        public IHttpActionResult ViewForum(int ForumID, int UID)
        {
            WebApi_BLL.T_Forums bll = new WebApi_BLL.T_Forums();
            //WebApi_BLL.T_User_BaseInfo tubll = new WebApi_BLL.T_User_BaseInfo();
            WebApi_BLL.T_Forum_Photo   tfpbll = new WebApi_BLL.T_Forum_Photo();
            WebApi_BLL.T_Forum_Comment tfcbll = new WebApi_BLL.T_Forum_Comment();
            WebApi_BLL.T_Forum_Buy     tfbbll = new WebApi_BLL.T_Forum_Buy();
            WebApi_BLL.T_User_BaseInfo tubll  = new WebApi_BLL.T_User_BaseInfo();

            WebApi_Model.T_Forums forumModle = bll.GetModel(ForumID);

            forumModle.UserBaseInfo = tubll.GetModel((int)forumModle.UID);
            //WebApi_Model.T_User_BaseInfo userModel = tubll.GetModel(UID);
            //forumModle.User = userModel;
            forumModle.Views += 1; //查看数+1
            bll.Update(forumModle);
            forumModle.Forum_Photo   = tfpbll.GetModelList("ForumID =" + ForumID);
            forumModle.Forum_Comment = tfcbll.GetModelList("ForumID = " + ForumID);
            forumModle.Forum_Buy     = tfbbll.GetModelList("ForumID=" + ForumID + " and UID = " + UID);

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(forumModle))));
        }
コード例 #5
0
        public IHttpActionResult GetFourmList()
        {
            int    Page     = int.Parse(requestHelper.GetRequsetForm("Page", ""));
            string strWhere = requestHelper.GetRequsetForm("strWhere", "");
            string strOrder = requestHelper.GetRequsetForm("strOrder", "");

            int TotalPage = 0;
            int PageSize  = 10;

            if (string.IsNullOrEmpty(strWhere))
            {
                strWhere = " 1 = 1";
            }

            if (string.IsNullOrEmpty(strOrder))
            {
                strOrder = " ForumID desc";
            }

            WebApi_BLL.T_Forums          bll  = new WebApi_BLL.T_Forums();
            List <WebApi_Model.T_Forums> list = bll.DataTableToList(DBHelper.GetListByPage("T_Forums", Page, PageSize, strWhere, strOrder, out TotalPage).Tables[0]);

            WebApi_BLL.T_Forum_Photo   tfpbll = new WebApi_BLL.T_Forum_Photo();
            WebApi_BLL.T_User_BaseInfo tubll  = new WebApi_BLL.T_User_BaseInfo();
            foreach (WebApi_Model.T_Forums m in list)
            {
                m.Forum_Photo  = tfpbll.GetModelList(" ForumID = " + m.ForumID);
                m.UserBaseInfo = tubll.GetModel((int)m.UID);
            }
            if (list != null)
            {
                return(Ok(ReturnJsonResult.GetJsonResult(1, TotalPage.ToString(), JsonConvert.SerializeObject(list))));
            }
            else
            {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "OK", "")));
            }
        }