예제 #1
0
        public string Add(int villageid, int room, int hall, int toilet, double minprice, double minarea, int layer,
                          int totallayer, short nature, short directions, short fitment, string villagename, string address, string titles,
                          string smallpath, short imgcount,
                          string condition, string shangquan, string county, string remark, int renttype, int rentype,
                          string imgs1, short isdel, int sourcefrom, string linkman, string tel, string buildid, string roomid)
        {
            int    userid = User.userid;
            string addip  = Utils.GetRealIP();
            int    _hid   = 0;

            using (shhouseEntities ent = new shhouseEntities())
            {
                try
                {
                    ObjectParameter houseid = new ObjectParameter("houseid", typeof(int));
                    ObjectParameter state   = new ObjectParameter("state", typeof(int));
                    ObjectParameter msg     = new ObjectParameter("msg", typeof(string));



                    int i = ent.House_Rent_Add_GR2018(userid, villageid, room, hall, toilet, minprice, minarea, layer,
                                                      totallayer, nature, directions, fitment, villagename, address, titles, smallpath, imgcount,
                                                      condition, shangquan, county, remark, renttype, isdel,
                                                      sourcefrom, addip, rentype, imgs1, linkman, tel, buildid, roomid, houseid, state, msg);


                    //List<string> imgs = new List<string>();
                    //imgs.AddRange(imgs1.Split(','));
                    //imgs.AddRange(imgs2.Split(','));
                    //房源发布后,去掉oss超时设置
                    //OssHelper.modifymeta(imgs);

                    int _state = (int)state.Value;
                    if (_state == 1)
                    {
                        _hid = Convert.ToInt32(houseid.Value);
                        return(JsonConvert.SerializeObject(new repmsg
                        {
                            state = _state,
                            msg = (string)msg.Value,
                            data = (int)houseid.Value
                        }));
                    }
                    else
                    {
                        return(JsonConvert.SerializeObject(new repmsg
                        {
                            state = _state,
                            msg = (string)msg.Value
                        }));
                    }
                }
                catch
                {
                    return(JsonConvert.SerializeObject(new repmsg
                    {
                        state = 0,
                        msg = "发布失败,请稍后再试"
                    }));
                }
            }
        }