コード例 #1
0
        public async Task <ApiResult> DeleteNotifications([FromBody] NotificationIdListInput notificationIdListInput)
        {
            var result = new ApiResult();

            if (!await _notificationService.DeleteAsync(HttpContext.User.GetUserId(), notificationIdListInput.NotificationIds, ModelState))
            {
                result.Code    = 400;
                result.Message = "删除失败:" + ModelState.FirstErrorMessage();
                return(result);
            }

            result.Code    = 200;
            result.Message = "删除成功";
            return(result);
        }
コード例 #2
0
        public async Task <ApiResult> ReadNotifications([FromBody] NotificationIdListInput notificationIdListInput)
        {
            int userId = int.Parse(HttpContext.User.Identity.Name);
            var result = new ApiResult();

            if (!await _notificationService.ReadAsync(userId, notificationIdListInput.NotificationIds, ModelState))
            {
                result.Code    = 400;
                result.Message = "设置已读失败:" + ModelState.FirstErrorMessage();
                return(result);
            }

            result.Code    = 200;
            result.Message = "设置已读成功";
            return(result);
        }