Ejemplo n.º 1
0
        public async Task <IHttpActionResult> AddAnAdmin(int userID, int ownerID, int groupID)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var group = await db.Groups.FirstOrDefaultAsync(g => g.GroupID == groupID);

            if (group == null)
            {
                return(NotFound());
            }

            var user = await db.Users.FirstOrDefaultAsync(u => u.UserID == userID);

            if (user == null)
            {
                return(NotFound());
            }

            await db.AddAnAdmin(groupID, ownerID, userID);

            return(Ok());
        }