示例#1
0
        public void CanANewRoleBeCreated()
        {
            Role a = new Role()
            {
                roleid      = 99,
                title       = "some text that came from testing",
                permissions = new List <RolePermissions>(),
            };

            a.permissions.Add(new RolePermissions()
            {
                keyid = "Some Role Name",
                value = "Some value to the role name"
            }
                              );
            a.permissions.Add(new RolePermissions()
            {
                keyid = "Some other Role Name",
                value = "Some other value to the role name"
            }
                              );

            _testRepo.Add(a);

            var insertedRole = _testRepo.FindAll().Where(w => w.title == a.title).First();

            _testid = insertedRole.roleid;
            Assert.AreEqual(a.title, insertedRole.title);
        }
        public IHttpActionResult PostRole(Role role)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            _RDB.Add(role);

            return(CreatedAtRoute("DefaultApi", new { id = role.Id }, role));
        }
示例#3
0
 public void Add(Role role) => _roleRepo.Add(role);
示例#4
0
 public void AddRole([FromBody] Role data)
 {
     RoleRepo.Add(data);
     _log.LogInformation($"The Role that is added {JsonConvert.SerializeObject(data)}");
 }