示例#1
0
        public RoleView CreateRole([FromBody] RoleView model)
        {
            Role role = mapper.Map <RoleView, Role>(model);

            role = roleRep.CreateRole(role);
            RoleView a = mapper.Map <Role, RoleView>(role);

            return(a);
        }
示例#2
0
        public async Task <IActionResult> Create(ApplicationRole role)
        {
            var createRole = await _role.CreateRole(role);


            if (createRole)
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }
示例#3
0
        public ActionResult Create([FromForm] roleViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var serializeRole = RoleMapper.SerializeRole(model);
            var newRole       = _role.CreateRole(serializeRole);

            return(Ok(newRole));
        }
示例#4
0
        public async Task <IActionResult> Create(RoleDto registerRole)
        {
            ApplicationRole r = new ApplicationRole();

            r.Name = registerRole.RoleName;

            var newRole = await _role.CreateRole(r);

            if (newRole)
            {
                return(RedirectToAction("Index"));
            }

            return(View());
        }
示例#5
0
        public async Task <IActionResult> Post([FromBody] RoleDto registerRole)
        {
            ApplicationRole r = new ApplicationRole();

            r.RoleName = registerRole.RoleName;


            var newRole = await _role.CreateRole(r);

            if (newRole)
            {
                return(Ok(new { message = "Role Created" }));
            }

            return(BadRequest(new { message = "Role not created" }));
        }
示例#6
0
 public IPeople CreateUser(int userId, string emailId, string firstName, string middleName, string lastName, int siteId, string siteUserId, List <IRole> roles, string password, List <IImage> userImages)
 {
     return(new People()
     {
         UserId = userId,
         EmailId = emailId,
         FirstName = firstName,
         MiddleName = middleName,
         LastName = lastName,
         Password = password,
         SiteId = siteId,
         SiteUserId = siteUserId,
         UserRoles = (from r in roles select _roleDomain.CreateRole(r.RoleId, r.RoleCode)).ToList(),
         UserImages = (from i in userImages select _imageDomain.CreateImage(i.ImageId, i.UserImage)).ToList()
     });
 }