예제 #1
0
        public ActionResult CancelMeeting(string meetingId)
        {
            ReturnResult result = _meetingService.CancelMeeting(meetingId);

            if (result.Result)
            {
                var returnSuccess = new { isSuccess = true };
                return(Content(Newtonsoft.Json.JsonConvert.SerializeObject(returnSuccess), "application/json"));
            }
            else
            {
                ModelState.AddModelError("", result.Message);
            }
            var returnFail = new
            {
                isSuccess = false,
                // ModelState错误信息
                ModelStateErrors = ModelState.Where(x => x.Value.Errors.Count > 0)
                                   .ToDictionary(k => k.Key, k => k.Value.Errors.Select(e => e.ErrorMessage).ToArray())
            };

            return(Content(Newtonsoft.Json.JsonConvert.SerializeObject(returnFail), "application/json"));
        }
 public ActionResult CancelMeeting(int meetingId)
 {
     _meetingService.CancelMeeting(UserId, meetingId);
     return(Ok());
 }