public ActionResult AdminEntry(AdminModel m) { //check for blank entries if (m.UserEmail == null || m.Role == null) { ViewBag.EmptyFielsAdnminEntry = "Must not leave any Admin entry fields blank. Try again."; return(View("AddAdmin", m)); } if (m.UserEmail.Length > 100) { ViewBag.InvalidEmail = "Email too long. Try again."; return(View("AddAdmin", m)); } if (m.Role.Length > 200) { ViewBag.InvalidRole = "Role too long. Try again."; return(View("AddAdmin", m)); } grabFromDB DB = new grabFromDB(); if (DB.getAdminByEmail(m.UserEmail).Count != 0) { ViewBag.InvalidEmail = "The user associated with this account is already an admin. Try again."; return(View("AddAdmin", m)); } //check if valid user if (DB.getUserListByEmail(m.UserEmail).Count == 0) { ViewBag.InvalidEmail = "This email is not associated with a current account. Try again."; return(View("AddAdmin", m)); } else { DB.insertAdmin(m.UserEmail, m.Role); ViewBag.ReturnValue = "Admin successfully added."; return(View("AdminPage")); } }