public async Task <ActionResult> AddSetStone(string orderId) { var manager = new BasicDataManager(); var matchStones = await manager.GetMatchStonesAsync(); var orderSetStoneInfoViewModel = new OrderSetStoneInfoViewModel { OrderId = orderId, MatchStones = matchStones }; return(View(orderSetStoneInfoViewModel)); }
public async Task <JsonResult> AddSetStone(OrderSetStoneInfoViewModel request) { if (!ModelState.IsValid) { return(Json(false, data: ErrorToDictionary())); } var orderSetStoneInfo = Mapper.Map <OrderSetStoneInfoViewModel, OrderSetStoneInfo>(request); var basicDataManager = new BasicDataManager(); var matchStone = await basicDataManager.GetMatchStoneAsync(request.MatchStoneId); orderSetStoneInfo.CreatorId = User.Id; orderSetStoneInfo.MathchStoneName = matchStone.Name; orderSetStoneInfo.Price = matchStone.Price; orderSetStoneInfo.WorkingCost = matchStone.WorkingCost * orderSetStoneInfo.Number; var orderSetStoneInfoManager = new OrderSetStoneInfoManager(); var result = await orderSetStoneInfoManager.CreateOrderSetStoneInfoAsync(orderSetStoneInfo); return(Json(result)); }