//[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 }); }
//[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 }); }
//[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 }); }
public async Task <NotificationSettingDTO> Put([FromBody] NotificationSettingDTO dto) { return(await _service.Update(dto)); }