/// <summary> /// 修改報價 /// </summary> /// <param name="Model"></param> /// <returns></returns> public async Task <JsonResult> ModifyQuote(DriverQuotePriceViewModel Model) { _logger.Information($"ModifyQuote : { JsonConvert.SerializeObject(Model)}"); ResponseViewModel responseResult = new ResponseViewModel(); try { var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name); responseResult = await _bookingService.UpdateOrDeleteQuotedRecordsByCreater(Model, user.Id, "Update"); if (responseResult.IsOk) { #region 修改報價推播通知 var queryDriver = _aspNetUsersService.GetUserModel(Model.DriverId); string appellationDriver = string.Empty; if (!string.IsNullOrEmpty(queryDriver.Sex)) { appellationDriver = StringExt.AppellationName(queryDriver.RealName, queryDriver.Sex.Trim()); } else { appellationDriver = queryDriver.RealName; } string title = Resource.Driver + appellationDriver + string.Format(Resource.QuotedPrice, Model.QuotedPrice); string body = string.Empty; string goodsOwnerId = _bookingService.GetBooking(Model.MessageId).GoodOwnerId; PushMessageViewModel pushMsg = RunPushApi(title, body, user.Id, goodsOwnerId, 10, Model.MessageId.ToString()); await RunPushApiAsync(pushMsg); #endregion } } catch (Exception ex) { _logger.Information($"Quote exception: { JsonConvert.SerializeObject(ex)}"); responseResult.IsOk = false; responseResult.Message = ex.ToString(); throw ex; } return(Json(responseResult, JsonRequestBehavior.DenyGet)); }
/// <summary> /// 取消報價 /// </summary> /// <param name="Model"></param> /// <returns></returns> public async Task <JsonResult> CancelQuote(DriverQuotePriceViewModel Model) { _logger.Information($"CancelQuote : { JsonConvert.SerializeObject(Model)}"); ResponseViewModel responseResult = new ResponseViewModel(); try { var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name); responseResult = await _bookingService.UpdateOrDeleteQuotedRecordsByCreater(Model, user.Id, "Delete"); } catch (Exception ex) { _logger.Information($"CancelQuote exception: { JsonConvert.SerializeObject(ex)}"); responseResult.IsOk = false; responseResult.Message = ex.ToString(); throw ex; } return(Json(responseResult, JsonRequestBehavior.DenyGet)); }