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()); } }