public HttpResponseMessage LeaveAMessage([FromBody] LeaveAMessage lmsg) { int status = 0; string info = string.Empty; try { if (!string.IsNullOrEmpty(lmsg.Name) && !string.IsNullOrEmpty(lmsg.Content)) { new LeaveAMessageBLL().Add(lmsg); info = "成功反馈,请耐心等待回复,感谢支付与理解"; status = 1; } else { info = "类型和内容不可为空"; } } catch (Exception ex) { info = "添加发生异常,请重试,或者qq联系:434951775"; // log.AddLog(ex, string.Format("留言发生异常:传入参数是【type:{0},msg:{1},userAgent:{2}】", type, msg, userAgent)); } return(JsonConvert.SerializeObject(new { status = status, info = info }).ToHttpResponseMessage()); }
public async Task<IHttpActionResult> LeaveAMessage(int id, [FromBody]LeaveAMessageVM vm) { Booking booking = _bookingService.Get(id); if (booking == null) { return NotFound(); } if (!booking.EnsoureState(BookingCommand.LeaveAMessage)) { return BadRequest("Invalid booking state."); } LeaveAMessage cs = new LeaveAMessage( _sequenceService.Next(Sequence.BookingAction), booking.ResourceId, booking.BookingId, vm.Message, DateTime.Now, userId); ActionResponse actionResponse = await _actionBus.SendAsync<BookingActionBase, LeaveAMessage>(cs); return Ok(ActionResponseVM.ToVM(actionResponse)); }