Ejemplo n.º 1
0
        public ActionResult AddRole(AddNewRoleModel newCast)
        {
            cast temp = new cast();

            temp.person_id      = newCast.personId;
            temp.movie_id       = dbMovie.getMovieByTitle(newCast.movieTitle).id;
            temp.role           = (int)Enum.Parse(typeof(movieRoles), newCast.role.ToLower().Trim());
            temp.character_name = newCast.characterName;

            dbPerson.addRole(temp);

            return(View());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Create(AddNewRoleModel role)
        {
            if (!ModelState.IsValid)
            {
                return(View(role));
            }
            var mrole = new ApplicationRole {
                Name        = role.RoleName,
                Description = role.Description,
                WhoCreate   = User.Identity.GetUserName()
            };
            var result = await RoleManager.CreateAsync(mrole);

            if (result.Succeeded)
            {
                return(View("_SuccessView", new { Result = "创建成功" }));
            }
            return(View());
        }