示例#1
0
        public ActionResult AddGoods(GoodsInfoView model)
        {
            if (!Authority())
            {
                return(_authorityResult);
            }

            // edit model
            var good = new MarketService.GoodsInfo()
            {
                Seller   = Request.Cookies.Get(DefaultAuthenticationTypes.ApplicationCookie).Value,
                AddDate  = DateTime.Now,
                Buyer    = string.Empty,
                Comments = string.Empty,
                Desp     = model.Desp,
                Money    = model.Money,
                Name     = model.Name,
                PicUrl   = model.PicUrl,
                Status   = @"待审核",
                Type     = model.Type
            };

            if (string.IsNullOrEmpty(good.PicUrl))
            {
                good.PicUrl = "00.jpg"; //default.
            }

            marketClient.UserAddGoods(good);

            // ret
            return(RedirectToAction("MyCenter"));
        }
示例#2
0
 public GoodsInfoView(MarketService.GoodsInfo model)
 {
     this.Id       = model.Id;
     this.Seller   = model.Seller;
     this.Name     = model.Name;
     this.Money    = model.Money;
     this.PicUrl   = model.PicUrl;
     this.Desp     = model.Desp;
     this.AddDate  = model.AddDate;
     this.Status   = model.Status;
     this.Buyer    = model.Buyer;
     this.Comments = model.Comments;
     this.Type     = model.Type;
 }
示例#3
0
        public void SetGoodsInfoSets(XmlNodeList nodeList)
        {
            foreach (XmlElement node in nodeList)
            {
                var model = new MarketService.GoodsInfo();
                model.Seller   = node.SelectSingleNode("seller")?.InnerText;
                model.Name     = node.SelectSingleNode("name")?.InnerText;
                model.Money    = Convert.ToInt32(node.SelectSingleNode("price")?.InnerText);
                model.PicUrl   = node.SelectSingleNode("url")?.InnerText;
                model.Desp     = node.SelectSingleNode("desp")?.InnerText;
                model.AddDate  = Convert.ToDateTime(node.SelectSingleNode("date")?.InnerText);
                model.Status   = node.SelectSingleNode("status")?.InnerText;
                model.Buyer    = node.SelectSingleNode("buyer")?.InnerText;
                model.Comments = node.SelectSingleNode("comments")?.InnerText;
                model.Type     = node.SelectSingleNode("type")?.InnerText;

                if (marketClient.HasMember(model))
                {
                    continue;
                }
                marketClient.UserAddGoods(model);
            }
        }