public void AccountGetByNameTest(int id, string firstname, string lastname, string email, string password, string username, bool admin) { AccountDTO dto = new AccountDTO(id, firstname, lastname, email, password, username, admin); AccountDTO result = converter.ModelToDTO(container.GetByName(converter.DtoToModel(dto))); dto.Should().BeEquivalentTo(result); }
public IActionResult Login(AccountDetailVM vm) { if (ModelState.IsValid) { vm = converter.ModelToViewModel(accountContainer.GetByName(converter.ViewModelToModel(vm))); if (vm.Id != 0) { HttpContext.Session.SetString("User", JsonConvert.SerializeObject(vm)); return(RedirectToAction("Index", "Forum")); } } return(View(vm)); }