public async Task <IActionResult> Create([Bind(properties)] AccountView c) { c.ID = BankId.NewBankId(); await validateId(c.ID, ModelState); if (!ModelState.IsValid) { return(View(c)); } c.Balance = 500; c.Status = Status.Active.ToString(); //c.Type = Enum.GetName(typeof(CardType), int.Parse(c.Type)); var loggedInUser = await userManager.GetUserAsync(HttpContext.User); c.AspNetUserId = loggedInUser.Id; var o = AccountFactory.CreateAccount(c.ID, c.Balance, c.Type, c.Status, c.AspNetUserId, c.ValidFrom = DateTime.Now, c.ValidTo = DateTime.Now.AddYears(2)); await repository.AddObject(o); await _bankHub.Clients.All.SendAsync("NewAccount", c.ID, c.Type, c.Balance, c.Status, c.ValidTo.Value.Date.ToShortDateString()); await createWelcomeNotification(c.ID); await createWelcomeTransaction(c.ID); return(RedirectToAction("Index", "Home")); }