private static Frontend.Models.User ConvertToFrontendUser(User u) { // get liked ads manually, because auto cast does not work var ads = new List <int?>(0); u.LikedAds.ForEach(id => ads.Add(id)); var user = new Frontend.Models.User() { Username = u.Username, HashedPassword = u.HashedPassword, LikedAds = ads, Phone = u.Phone, Email = u.Email, Role = u.Role, Disabled = u.Disabled }; return(user); }
private static User ConvertToUser(Frontend.Models.User u) { // get liked ads manually, because auto cast does not work var ads = new List <int>(0); foreach (int adId in u.LikedAds) { ads.Add(adId); } var user = new User() { Username = u.Username, HashedPassword = u.HashedPassword, LikedAds = ads, Phone = (long)u.Phone, Email = u.Email, Role = u.Role, Disabled = (bool)u.Disabled }; return(user); }