Beispiel #1
0
        public ActionResult <GroupItem> getGroup(int id)
        {
            GroupItem group = groupsDB.getGroup(id);

            if (group == null)
            {
                return(NotFound($"No Group found for id: {id}"));
            }
            else
            {
                return(Ok(group));
            }
        }
Beispiel #2
0
        public IActionResult addUserGroupBinding([FromQuery] int UserID, [FromQuery] int GroupID)
        {
            IActionResult ret = null;

            //check User
            if (userDB.getUserItem(UserID) == null)
            {
                ret = BadRequest($"No UserItem with id {UserID} found");
            }
            //check Group
            if (groupsDB.getGroup(GroupID) == null)
            {
                ret = BadRequest($"No GroupItem with id {GroupID} found");
            }
            //create binding
            if (ret == null)
            {
                ret = Ok(userGroupBindingDB.addUserGroupBinding(UserID, GroupID));
            }
            return(ret);
        }