AdminRequest

Namespace: Microsoft.Graph
We found 10 examples in language CSharp for this search. You will see 26 fragments of code.

Other methods


        public void EditCharity(Charity charity)
        {
            using (SqlConnection con = new SqlConnection(Configuration.someeServer))
            {
                con.Open();
                SqlCommand cmd = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = AdminRequest.UpdateCharity(charity);
                cmd.ExecuteNonQuery();
            }
        }

        public void AddCharity(string name, string desc, string logo)
        {
            using (SqlConnection con = new SqlConnection(Configuration.someeServer))
            {
                con.Open();
                SqlCommand cmd = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = AdminRequest.NewCharity(name, desc, logo);
                cmd.ExecuteNonQuery();
            }
        }

        public void EditUser(User user)
        {
            using (SqlConnection con = new SqlConnection(Configuration.someeServer))
            {
                con.Open();
                SqlCommand cmd = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = AdminRequest.UpdateUser(user);
                cmd.ExecuteNonQuery();
            }
        }


        [Route("banUser")]
        [HttpPost]
        public ActionResult<User> banUser(AdminRequest adminRequest)
        {
            var canBan = isAdmin();
            return canBan.Value == true ? service.BanUser(adminRequest.UserEmail) : Unauthorized();
        }

        [Route("setAdminStatus")]
        [HttpPost]
        public ActionResult<User> addAdmin(AdminRequest adminRequest)
        {
            var canAdd = isAdmin();
            return canAdd.Value == true ? service.SetAdminStatus(adminRequest.UserEmail) : Unauthorized();
        }

        [Route("deleteUser")]
        [HttpPost]
        public ActionResult<Boolean> DeleteUser(AdminRequest adminRequest)
        {
            var canDelete = isAdmin();
            return canDelete.Value == true ? service.DeleteUser(adminRequest.UserEmail) : Unauthorized();
        }


		public Task CreateDatabaseAsync(DatabaseDocument databaseDocument)
		{
			RavenJObject doc;
			var req = adminRequest.CreateDatabase(databaseDocument, out doc);

			return req.WriteAsync(doc.ToString(Formatting.Indented));
		}

		public Task DeleteDatabaseAsync(string databaseName, bool hardDelete = false)
		{
			return adminRequest.DeleteDatabase(databaseName, hardDelete).ExecuteRequestAsync();
		}

		public Task CompactDatabaseAsync(string databaseName)
		{
			return adminRequest.CompactDatabase(databaseName).ExecuteRequestAsync();
		}

		public Task StopIndexingAsync()
		{
			return innerAsyncServerClient.ExecuteWithReplication("POST", operationMetadata => adminRequest.StopIndexing(operationMetadata.Url).ExecuteRequestAsync());
		}

		public Task StartIndexingAsync()
		{
			return innerAsyncServerClient.ExecuteWithReplication("POST", operationMetadata => adminRequest.StartIndexing(operationMetadata.Url).ExecuteRequestAsync());
		}

		public async Task<AdminStatistics> GetStatisticsAsync()
		{
			var json = (RavenJObject) await adminRequest.AdminStats().ReadResponseJsonAsync();

			return json.Deserialize<AdminStatistics>(innerAsyncServerClient.convention);
		}


        public List<AdminRequest> DB_Get_Admin_Requests()
        {
            string query = "SELECT admin_request_id, user_username, AdminRequest.user_id FROM AdminRequest INNER JOIN Users ON AdminRequest.user_id = Users.user_id";
            SqlParameter[] sqlParameters = new SqlParameter[0];
            return ReadRequests(ExecuteSelectQuery(query, sqlParameters));
        }

using Microsoft.EntityFrameworkCore;
using api.Entities;

namespace api.Contexts
{
    public class RecipeContext : DbContext
    {

        public RecipeContext(DbContextOptions<RecipeContext> options) : base(options)
        {  }

        public DbSet<Recipe> recipe { get; set; }
        public DbSet<Ingredient> ingredients { get; set; }
        public DbSet<Steps> steps { get; set; }
        public DbSet<SubSteps> substeps { get; set; }
        public DbSet<Tips> tips { get; set; }
        public DbSet<SubTips> subtips { get; set; }
        public DbSet<Users> users { get; set; }
        public DbSet<AdminRequest> adminrequest { get; set; }

    }
}

        public LoginResponse AdminLogin(LoginRequest loginRequest)
        {
            if(loginRequest!=null)
            {
                return this.adminRepository.AdminLogin(loginRequest);
            }
            return null;
        }

        public AdminResponse AdminRegistration(AdminRequest adminRequest)
        {
            if (adminRequest != null)
            {
                return this.adminRepository.AdminRegistration(adminRequest);
            }
            return null;
        }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Epi.Web.Common.DTO;
using System.Runtime.Serialization;

namespace Epi.Web.Common.Message
    {
    [DataContract(Namespace = "http://www.yourcompany.com/types/")]
    public class AdminRequest : Epi.Web.Common.MessageBase.RequestBase
        {

        public AdminRequest()
        {
          //  this.AdminEmail = new AdminDTO();
        }
        [DataMember]
        public string AdminEmail;
            

        [DataMember]
        public string OrganizationId;
        [DataMember]
        public string OrganizationKey; 

        [DataMember]
        public bool IsActive;
            


        }
    }


		public void Handle(bool accept)
		{
			if (Status != RequestStatus.Unhandled)
				throw new InvalidOperationException();

			if (accept)
				Status = RequestStatus.Accepted;
			else
				Status = RequestStatus.Refused;

			UpdatedAtNow();
		}


    public async Task<AdminRequest> Get(Guid userId, Guid competitionId)
    {
      return await _context.AdminRequests
        .FirstOrDefaultAsync(x => x.UserId == userId && x.CompetitionId == competitionId);
    }

    public async Task<IEnumerable<AdminRequest>> GetList(Guid competitionId)
    {
      return await _context.AdminRequests
        .Where(x => x.CompetitionId == competitionId)
        .ToListAsync();
    }

    public void Create(AdminRequest adminRequest)
    {
      _context.AdminRequests.Add(adminRequest);
    }

    public void Delete(AdminRequest adminRequest)
    {
      _context.AdminRequests.Remove(adminRequest);
    }

    Task<AdminRequest> Get(Guid userId, Guid competitionId);
    Task<IEnumerable<AdminRequest>> GetList(Guid competitionId);
    void Create(AdminRequest adminRequest);
    void Delete(AdminRequest adminRequest);

Microsoft.Graph.AdminRequest : IBaseRequest, IAdminRequest

Constructors :

public AdminRequest(String requestUrl = , IBaseClient client = , IEnumerable<Option> options = )

Methods :

public Task<Admin> CreateAsync(Admin adminToCreate = , CancellationToken cancellationToken = null)
public Task<GraphResponse<Admin>> CreateResponseAsync(Admin adminToCreate = , CancellationToken cancellationToken = null)
public Task DeleteAsync(CancellationToken cancellationToken = null)
public Task<GraphResponse> DeleteResponseAsync(CancellationToken cancellationToken = null)
public Task<Admin> GetAsync(CancellationToken cancellationToken = null)
public Task<GraphResponse<Admin>> GetResponseAsync(CancellationToken cancellationToken = null)
public Task<Admin> UpdateAsync(Admin adminToUpdate = , CancellationToken cancellationToken = null)
public Task<GraphResponse<Admin>> UpdateResponseAsync(Admin adminToUpdate = , CancellationToken cancellationToken = null)
public Task<Admin> PutAsync(Admin adminToUpdate = , CancellationToken cancellationToken = null)
public Task<GraphResponse<Admin>> PutResponseAsync(Admin adminToUpdate = , CancellationToken cancellationToken = null)
public IAdminRequest Expand(String value = )
public IAdminRequest Expand(Expression<Func<Admin, Object>> expandExpression = )
public IAdminRequest Select(String value = )
public IAdminRequest Select(Expression<Func<Admin, Object>> selectExpression = )
public IResponseHandler get_ResponseHandler()
public Void set_ResponseHandler(IResponseHandler value = )
public String get_ContentType()
public Void set_ContentType(String value = )
public IList<HeaderOption> get_Headers()
public IBaseClient get_Client()
public HttpMethods get_Method()
public Void set_Method(HttpMethods value = )
public IList<QueryOption> get_QueryOptions()
public Void set_QueryOptions(IList<QueryOption> value = )
public String get_RequestUrl()
public IDictionary<String, IMiddlewareOption> get_MiddlewareOptions()
public Task SendAsync(Object serializableObject = , CancellationToken cancellationToken = , HttpCompletionOption completionOption = ResponseContentRead)
public Task<T> SendAsync(Object serializableObject = , CancellationToken cancellationToken = , HttpCompletionOption completionOption = ResponseContentRead)
public Task<T> SendMultiPartAsync(MultipartContent multipartContent = , CancellationToken cancellationToken = , HttpCompletionOption completionOption = ResponseContentRead)
public Task<Stream> SendStreamRequestAsync(Object serializableObject = , CancellationToken cancellationToken = , HttpCompletionOption completionOption = ResponseContentRead)
public Task<HttpResponseMessage> SendMultiPartRequestAsync(MultipartContent multipartContent = , CancellationToken cancellationToken = , HttpCompletionOption completionOption = ResponseContentRead)
public Task<GraphResponse> SendAsyncWithGraphResponse(Object serializableObject = , CancellationToken cancellationToken = , HttpCompletionOption completionOption = ResponseContentRead)
public Task<GraphResponse<T>> SendAsyncWithGraphResponse(Object serializableObject = , CancellationToken cancellationToken = , HttpCompletionOption completionOption = ResponseContentRead)
public Task<HttpResponseMessage> SendRequestAsync(Object serializableObject = , CancellationToken cancellationToken = , HttpCompletionOption completionOption = ResponseContentRead)
public HttpRequestMessage GetHttpRequestMessage(CancellationToken cancellationToken = )
public HttpRequestMessage GetHttpRequestMessage()
public Void AppendSegmentToRequestUrl(String urlSegment = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()