/// <summary> /// 保存物品转让信息 /// </summary> /// <param name="goods">物品转让信息</param> /// <returns>是否保存成功</returns> public bool SaveTransferGoods(GoodsTransferInfo goods) { using (FxGoodsContext context = new FxGoodsContext()) { context.GoodsTransferInfos.Add(goods); context.SaveChanges(); } return(goods.GoodsTransferInfoId > 0); }
private ActionResult PublishGoods(TransferViewGoods goods, List <HttpPostedFileBase> facefile, List <HttpPostedFileBase> otherfile, List <HttpPostedFileBase> badfile) { if (BuildGoods(goods, facefile, otherfile, badfile)) { GoodsTransferInfo transfergoods = MapperGoods(goods); transferService.SaveTransferGoods(transfergoods); RunJob(); FxCacheService.FxSite.GlobalCache cache = System.Web.Mvc.DependencyResolver.Current.GetService <FxCacheService.FxSite.GlobalCache>(); cache.InfoPublishAllCountAdd(); return(View("Success")); } return(View("FaildTransfer")); }
private GoodsTransferInfo MapperGoods(TransferViewGoods goods) { var info = new GoodsTransferInfo(); info.CatagroyId = goods.CatagroyId; info.AreaId = goods.AreaId; info.ChangeMsg = goods.ChangeGoodsMsg; info.Controller = this.ControllerName; info.Action = this.ActionName; info.CityId = goods.CityId; info.GoodsConditionMsg = goods.GoodConditonMsg; info.GoodsconditonId = goods.GoodConditionId; info.IsChange = goods.IsChangeGoods; info.Mark = goods.Mark; goods.FaceFiles.ForEach(r => info.Pictures.Add(r)); goods.OtherFiles.ForEach(r => info.Pictures.Add(r)); goods.BadFiles.ForEach(r => info.Pictures.Add(r)); info.Price = (int)goods.Price; info.PublishTitle = goods.Title; info.PublishUserEmail = goods.Email; info.UserAccount = User.Identity.Name; return(info); }