public async Task <bool> AddRole(int id, Role role)
        {
            try
            {
                role = await SetObjectRole(id, role);

                if (role is null)
                {
                    return(false);
                }
                if (!await RoleExist(role, 0))
                {
                    return(false);
                }
                await _db.AddAsync(role);

                await _db.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        public async Task <bool> AddActor(Actor a)
        {
            try
            {
                await _db.AddAsync(a);

                await _db.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }