예제 #1
0
        //[AllowAnonymous]
        public MessageModel <NotificationSettingDTO> SwitchNotification([FromBody] NotificationSettingRequest request)
        {
            var userId = int.Parse(User.FindFirstValue("id"));
            PushNotificationSetting result = notificationService.SwitchNotification(userId, request.IsTurnOn);
            NotificationSettingDTO  dto    = mapper.Map <NotificationSettingDTO>(result);

            return(new MessageModel <NotificationSettingDTO>
            {
                Msg = result == null ? "error" : "",
                Data = dto
            });
        }
예제 #2
0
        //[AllowAnonymous]
        public MessageModel <NotificationSettingDTO> GetNotificationState()
        {
            var userId = int.Parse(User.FindFirstValue("id"));
            PushNotificationSetting result = notificationService.GetNotificationState(userId);
            NotificationSettingDTO  dto    = mapper.Map <NotificationSettingDTO>(result);

            return(new MessageModel <NotificationSettingDTO>
            {
                Msg = result == null ? "error" : "",
                Data = dto
            });
        }
예제 #3
0
        //[AllowAnonymous]
        public MessageModel <NotificationSettingDTO> UpdateMobileToken([FromBody] NotificationTokenRequest request)
        {
            var userId = int.Parse(User.FindFirstValue("id"));
            //int userId = 1;
            PushNotificationSetting result = notificationService.UpdateMobileToken(userId, request.MobileToken);
            NotificationSettingDTO  dto    = mapper.Map <NotificationSettingDTO>(result);

            return(new MessageModel <NotificationSettingDTO>
            {
                Msg = result == null?"error":"",
                Data = dto
            });
        }
예제 #4
0
 public async Task <NotificationSettingDTO> Put([FromBody] NotificationSettingDTO dto)
 {
     return(await _service.Update(dto));
 }