public async Task <InvokedResult> CreateSpotGoods(SpotGoods spotGoods) { spotGoods.CreatorId = User.Id; DbContext.Set <SpotGoods>().AddOrUpdate(spotGoods); await DbContext.SaveChangesAsync(); return(InvokedResult.SucceededResult); }
public SpotGoodListItemViewModel(SpotGoods spotGood) { Id = spotGood.Id; Name = spotGood.SpotGoodsPattern.Name; SpotGoodsType = spotGood.SpotGoodsPattern.Type.GetDisplayName(); HandSize = spotGood.HandSize; MainStone = spotGood.MainStone; Weight = spotGood.Weight; GoldWeight = spotGood.GoldWeight; Price = decimal.Round((decimal)spotGood.Price, 2); ColorFormName = spotGood.ColorForm.Name; ColorFormId = spotGood.ColorForm.Id; SetStoneNames = string.Join("/", spotGood.SetStoneInfos.Select(r => r.MatchStoneName)); SetStoneNumbers = string.Join("/", spotGood.SetStoneInfos.Select(r => r.Number)); SetStoneWeights = string.Join("/", spotGood.SetStoneInfos.Select(r => r.Weight)); BasicCost = spotGood.BasicCost; Loss18KRate = spotGood.Loss18KRate; }