private static userDtos.User GetUserDto(userModels.User user) => new userDtos.User { DisplayName = user.DisplayName, Email = user.Email, FirstName = user.FirstName, Handle = user.Handle, Id = user.Id, LastName = user.LastName };
/// <summary> /// Переводит подьзователя из серверной модели в клиентскую /// </summary> /// <param name="modelUser">Пользователь в серверной модели</param> /// <returns>Пользователь в клиентской модели</returns> public static Client.User Convert(Model.User modelUser) { if (modelUser == null) { throw new ArgumentNullException(nameof(modelUser)); } var clientUser = new Client.User { Id = modelUser.Id.ToString(), Login = modelUser.Login, RegisteredAt = modelUser.RegisteredAt }; return(clientUser); }
public static Client.User Convert(Model.User modelUser) { if (modelUser == null) { throw new ArgumentNullException(nameof(modelUser)); } var clientUser = new Client.User { Id = modelUser.Id, UserName = modelUser.NormalizedUserName, Name = modelUser.Name, Email = modelUser.Email, PhoneNumber = modelUser.PhoneNumber, Roles = modelUser.Roles, RegisteredAt = modelUser.RegisteredAt, LastUpdateAt = modelUser.LastUpdateAt }; return(clientUser); }
public static Client.User Convert(Model.User modelUser) { if (modelUser == null) { throw new ArgumentNullException(nameof(modelUser)); } var clientUser = new Client.User { Id = modelUser.Id, UserName = modelUser.NormalizedUserName, Email = modelUser.Email, PhoneNumber = modelUser.PhoneNumber, Roles = modelUser.Roles, CreatedTroubles = (IReadOnlyList <string>)modelUser.CreatedTroubles, LikedTroubles = (IReadOnlyList <string>)modelUser.LikedTroubles, CreatedAt = modelUser.CreatedAt, LastUpdatedAt = modelUser.LastUpdatedAt }; return(clientUser); }
private async Task <GenericResult <notificationModels.Notification, string> > CreateNotification(UserEvent userEvent, userModels.User follower, userModels.User followee) { // TODO: ideally these notificationtypeids should be fetched from persistent layer. long notificationType = userEvent.EventType == UserEventType.FollowRequestCreate ? 1 : 2; var content = notificationType == 1 ? $"{follower.DisplayName} has requested to follow you" : $"{followee.DisplayName} has accepted your follow request"; long userId = userEvent.EventType == UserEventType.FollowRequestCreate ? followee.Id : follower.Id; var createNotificationRequest = new CreateNotificationRequest { UserId = userId, Content = content, Type = notificationType }; return(await _notificationsLogic.Create(createNotificationRequest)); }