Skip to content

Instantly share code, notes, and snippets.

Avatar

John Ojo JIOO-phoeNIX

View GitHub Profile
View NavMenu.razor
<div class="top-row pl-4 navbar navbar-dark">
<a class="navbar-brand" href="">GraphQLSampleAppUI</a>
<button class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span>
</button>
</div>
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
<ul class="nav flex-column">
<li class="nav-item px-3">
View CreateEmployee.razor
@page "/CreateEmployee"
@using GraphQLSampleAppUI.DataAccess;
@using GraphQLSampleAppUI.DataAccess.Model;
@inject NavigationManager NavigationManager
<h1>Create An Employee</h1>
View ViewEmployee.razor
@page "/ViewEmployee/{Id:int}"
@using GraphQLSampleAppUI.DataAccess;
@using GraphQLSampleAppUI.DataAccess.Model;
@inject NavigationManager NavigationManager
@if (employee.Name == null)
View EmployeeView.razor
@page "/EmployeeView"
@using GraphQLSampleAppUI.DataAccess;
@using GraphQLSampleAppUI.DataAccess.Model;
@inject NavigationManager NavigationManager
<h1>All Employee</h1>
View CreateEmployeeReturnModel.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace GraphQLSampleAppUI.DataAccess.Model
{
public class CreateEmployeeReturnModel
{
public int DepartmentId { get; set; }
View CreateEmployeeModel.cs
using System;
using System.ComponentModel.DataAnnotations;
namespace GraphQLSampleAppUI.DataAccess.Model
{
public class CreateEmployeeModel
{
[Required(ErrorMessage = "Name is required")]
public string Name { get; set; }
View Department.cs
using System.Collections.Generic;
namespace GraphQLSampleAppUI.DataAccess.Model
{
public class Department
{
public int DepartmentId { get; set; }
public string Name { get; set; }
View Employee.cs
namespace GraphQLSampleAppUI.DataAccess.Model
{
public class Employee
{
public int EmployeeId { get; set; }
public string Name { get; set; }
public string Email { get; set; }
View Mutation.cs
using GraphQL;
using GraphQL.Client.Http;
using GraphQL.Client.Serializer.Newtonsoft;
using ModernHttpClient;
using Newtonsoft.Json;
using System;
using System.Threading.Tasks;
namespace GraphQLSampleAppUI.DataAccess
{
View Query.cs
using GraphQL;
using GraphQL.Client.Http;
using ModernHttpClient;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using GraphQL.Client.Serializer.Newtonsoft;
using Newtonsoft.Json;