[Route("/users/{userId}")] public class UserService : Service { [Get] public User Get(UserRequest request) { return userRepository.Get(request.UserId) } [Post] public void Post(User user) { userRepository.Add(user); } [Put] public void Put(User user) { userRepository.Update(user); } [Delete] public void Delete(UserRequest request) { userRepository.Delete(request.UserId); } }
public void SendPushNotification(string deviceToken, string title, string message) { var fcmClient = new FcmClient("your-firebase-server-key"); var notification = new FcmNotification { Title = title, Body = message, }; var message = new FcmMessage { Token = deviceToken, Notification = notification, }; var response = await fcmClient.SendAsync(message); }
public class ChatHub : Hub { public void Send(string message) { Clients.All.SendAsync("ReceiveMessage", Context.ConnectionId, message); } }Overall, C# Server Mobile is a powerful package library that enables you to build complex server-side applications to support your mobile clients.