public static Contracts.Client.IControllerAccess <I> Create <I>(string sessionToken) where I : Contracts.IIdentifiable { Contracts.Client.IControllerAccess <I> result = null; if (typeof(I) == typeof(QnSContactManager.Contracts.Persistence.App.IContact)) { result = new Controllers.Persistence.App.ContactController(CreateContext()) { SessionToken = sessionToken } as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSContactManager.Contracts.Persistence.Account.IRole)) { result = new Controllers.Persistence.Account.RoleController(CreateContext()) { SessionToken = sessionToken } as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSContactManager.Contracts.Business.Account.IAppAccess)) { result = new Controllers.Business.Account.AppAccessController(CreateContext()) { SessionToken = sessionToken } as Contracts.Client.IControllerAccess <I>; } return(result); }
public static async Task InitAppAccessAsync(string name, string email, string password, bool enableJwtAuth) { using var appAccessCtrl = new Controllers.Business.Account.AppAccessController(Factory.CreateContext()) { SessionToken = Authorization.SystemAuthorizationToken, }; var appAccessCount = await appAccessCtrl.CountAsync().ConfigureAwait(false); if (appAccessCount == 0) { var appAccess = await appAccessCtrl.CreateAsync().ConfigureAwait(false); appAccess.Identity.Name = name; appAccess.Identity.Email = email; appAccess.Identity.Password = password; appAccess.Identity.EnableJwtAuth = enableJwtAuth; var role = appAccess.CreateRole(); role.Designation = "SysAdmin"; appAccess.AddRole(role); await appAccessCtrl.InsertAsync(appAccess).ConfigureAwait(false); await appAccessCtrl.SaveChangesAsync().ConfigureAwait(false); } else { throw new LogicException(ErrorType.InitAppAccess); } }
public static Contracts.Client.IControllerAccess <I> Create <I>() where I : Contracts.IIdentifiable { Contracts.Client.IControllerAccess <I> result = null; if (typeof(I) == typeof(QuickNSmart.Contracts.Persistence.TestOneToMany.IInvoice)) { result = new Controllers.Persistence.TestOneToMany.InvoiceController(CreateContext()) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QuickNSmart.Contracts.Persistence.TestOneToMany.IInvoiceDetail)) { result = new Controllers.Persistence.TestOneToMany.InvoiceDetailController(CreateContext()) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QuickNSmart.Contracts.Persistence.Account.IRole)) { result = new Controllers.Persistence.Account.RoleController(CreateContext()) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QuickNSmart.Contracts.Persistence.Account.IUser)) { result = new Controllers.Persistence.Account.UserController(CreateContext()) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QuickNSmart.Contracts.Business.TestOneToMany.IInvoiceDetails)) { result = new Controllers.Business.TestOneToMany.InvoiceDetailsController(CreateContext()) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QuickNSmart.Contracts.Business.Account.IAppAccess)) { result = new Controllers.Business.Account.AppAccessController(CreateContext()) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QuickNSmart.Contracts.Business.Account.IIdentityUser)) { result = new Controllers.Business.Account.IdentityUserController(CreateContext()) as Contracts.Client.IControllerAccess <I>; } return(result); }
public static Contracts.Client.IControllerAccess <I> Create <I>(object sharedController) where I : Contracts.IIdentifiable { Contracts.Client.IControllerAccess <I> result = null; if (typeof(I) == typeof(QnSContactManager.Contracts.Persistence.App.IContact)) { result = new Controllers.Persistence.App.ContactController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSContactManager.Contracts.Persistence.Account.IRole)) { result = new Controllers.Persistence.Account.RoleController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSContactManager.Contracts.Business.Account.IAppAccess)) { result = new Controllers.Business.Account.AppAccessController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } return(result); }
public static Contracts.Client.IControllerAccess <I> Create <I>() where I : Contracts.IIdentifiable { Contracts.Client.IControllerAccess <I> result = null; if (typeof(I) == typeof(QnSHolidayCalendar.Contracts.Persistence.App.ICalendarEntry)) { result = new Controllers.Persistence.App.CalendarEntryController(CreateContext()) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSHolidayCalendar.Contracts.Persistence.Account.IRole)) { result = new Controllers.Persistence.Account.RoleController(CreateContext()) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSHolidayCalendar.Contracts.Business.App.IHolidayEntry)) { result = new Controllers.Business.App.HolidayEntryController(CreateContext()) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSHolidayCalendar.Contracts.Business.Account.IAppAccess)) { result = new Controllers.Business.Account.AppAccessController(CreateContext()) as Contracts.Client.IControllerAccess <I>; } return(result); }
public static Contracts.Client.IControllerAccess <I> Create <I>(object sharedController) where I : Contracts.IIdentifiable { Contracts.Client.IControllerAccess <I> result; if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Language.ITranslation)) { result = new Controllers.Persistence.Language.TranslationController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Data.IBinaryData)) { result = new Controllers.Persistence.Data.BinaryDataController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Configuration.IIdentitySetting)) { result = new Controllers.Persistence.Configuration.IdentitySettingController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Configuration.ISetting)) { result = new Controllers.Persistence.Configuration.SettingController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.App.IAward)) { result = new Controllers.Persistence.App.AwardController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.App.IJuror)) { result = new Controllers.Persistence.App.JurorController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.App.IMember)) { result = new Controllers.Persistence.App.MemberController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.App.IProject)) { result = new Controllers.Persistence.App.ProjectController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.App.IRating)) { result = new Controllers.Persistence.App.RatingController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.IAccess)) { result = new Controllers.Persistence.Account.AccessController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.IActionLog)) { result = new Controllers.Persistence.Account.ActionLogController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.IIdentity)) { result = new Controllers.Persistence.Account.IdentityController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.IIdentityXRole)) { result = new Controllers.Persistence.Account.IdentityXRoleController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.ILoginSession)) { result = new Controllers.Persistence.Account.LoginSessionController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.IRole)) { result = new Controllers.Persistence.Account.RoleController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.IUser)) { result = new Controllers.Persistence.Account.UserController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Business.Account.IAppAccess)) { result = new Controllers.Business.Account.AppAccessController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else if (typeof(I) == typeof(QnSProjectAward.Contracts.Business.Account.IIdentityUser)) { result = new Controllers.Business.Account.IdentityUserController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>; } else { throw new Logic.Modules.Exception.LogicException(Modules.Exception.ErrorType.InvalidControllerType); } return(result); }