public ActionResult Create(Staff staff) { try { var user = accountDB.GetUserByName(User.Identity.Name); staff.CompanyID = user.CompanyID; staff.Company = adminWebDB.GetCompanyByCompanyID(staff.CompanyID); // Generate 4 digit pin for user System.Random RandNum = new System.Random(); staff.Password = Convert.ToString(RandNum.Next(9999)); adminWebDB.CreateStaff(staff); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(Staff staff) { try { // TODO: Add insert logic here // Muna að bæta við CompanyID og generate-a password og senda mail með upplýsingum var user = accountDB.GetUserByName(User.Identity.Name); staff.CompanyID = user.CompanyID; staff.Company = adminWebDB.GetCompanyByCompanyID(staff.CompanyID); System.Random RandNum = new System.Random(); staff.Password = Convert.ToString(RandNum.Next(9999)); adminWebDB.CreateStaff(staff); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Index() { int companyID = accountDB.GetUserByName(User.Identity.Name).CompanyID; Company company = adminWebDB.GetCompanyByCompanyID(companyID); // Check if user has filled his company info, if not then he's redirected to CompanyWizard to fill inn info. if (String.IsNullOrEmpty(company.SSN)) { return(View("CompanyWizard", company)); } else { DashboardViewModel dashboardVM = new DashboardViewModel(); dashboardVM.Staffs = adminWebDB.GetFirst5Staff(); dashboardVM.Transactions = adminWebDB.Get5NewestTransactions(); dashboardVM.Notifications = adminWebDB.Get5NewestNotifications(); dashboardVM.Companies = adminWebDB.First5Companies(); return(View(dashboardVM)); } }