public static Account AccountModelToEntity(AccountModel model) { Account entity = new Account(); entity.Username = model.Username; //entity.Room = RoomModelToEntity(model.Room); return entity; }
/// <summary> /// Adds Users to the existing room /// </summary> /// <param name="room">Room that user is being added to</param> /// <param name="account">AccountModel of user being added to room</param> public void AddRoomAccount(RoomModel room, AccountModel account) { if (!SongRepository.GetRoomAccounts(room.RoomId).Any(a => a.Username == account.Username)) { SongRepository.AddRoomAccount(room.RoomId, account.LoginId); } }
/// <summary> /// Adds user to the list of users in site /// </summary> /// <param name="username">Checks if the user is here first</param> public void AddAccount(string username) { if (!SongRepository.GetAccountsList().Any(a => a.Username == username)) { AccountModel account = new AccountModel() { Username = username }; SongRepository.AddAccount(account); } }
public ActionResult Profile(string username) { ViewBag.Title = username + "'s Profile"; SongManager SongManager = new SongManager(); AccountModel account = new AccountModel(); account.Songs = SongManager.GetSongList(username).OrderByDescending(s => s.SongID).ToList(); account.Playlists = new List<PlaylistModel>(); return View(account); }
/// <summary> /// Adds new Account to database /// </summary> /// <param name="account">AccountModel of account being added</param> public void AddAccount(AccountModel account) { //Convert the AccountModel to an Account entity and push to the database. Account entity = ModelConversions.AccountModelToEntity(account); _context.Accounts.Add(entity); _context.SaveChanges(); }