示例#1
0
        public RedirectToRouteResult AddAuthor(Author newAuthor)
        {
            bool isAuthorized = Administrator.IsAuthorized((string)(Session["UserSession"]), (int)(Session["UserRank"]), (int)Authorization.Rank.administrator);

            if (isAuthorized)
            {
                newAuthor.Aid = AuthorManager.GetAuthorList().Count();
                // string fname, string lname, string byear
                if (ModelState.IsValid)
                {
                    AuthorManager.AddAnAuthor(newAuthor);
                    return(RedirectToAction("ListAuthors", "Author"));
                }
            }
            TempData["Error"] = "Something went wrong!";
            return(RedirectToAction("AddAuthor"));
        }