public async Task <ActionResult <IdentityTypes> > PostIdentityTypes(IdentityTypes identityTypes) { _context.IdentityTypes.Add(identityTypes); await _context.SaveChangesAsync(); return(CreatedAtAction("GetIdentityTypes", new { id = identityTypes.IdentityTypesId }, identityTypes)); }
public async Task <IActionResult> PutIdentityTypes(int id, IdentityTypes identityTypes) { if (id != identityTypes.IdentityTypesId) { return(BadRequest()); } _context.Entry(identityTypes).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IdentityTypesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public static string IdentityTypeToElbaString(IdentityTypes identityType) { switch (identityType) { case IdentityTypes.Kundennummer: return("Kundennummer"); } return(string.Empty); }
public async Task <IActionResult> PutIdentityTypes(int id, IdentityTypes identityTypes) { if (id != identityTypes.IdentityTypeId) { return(BadRequest()); } var response = await _db.UpdateIdentityType(id, identityTypes); return(_responsesService.PutResponse(response)); }
public async Task <SaveIdentityResult> Save(string username, string email, IdentityTypes type) { string password = Guid.NewGuid().ToString("N").Substring(0, 8); var result = await Create(username, email, password, password, type); if (result.Type == Ok) { await _mediator.Publish(AccountCreated.From(result.Identity, password)); } return(result); }
protected User(RegistrationModelBase model) { this.UserName = model.UserName; this.Email = model.Email; this.PhoneNumber = model.PhoneNumber; this.Type = model.Type; // FIXME: We need to do something about this // Emails need to be verified if (string.IsNullOrEmpty(Email)) this.EmailConfirmed = false; //FIXME: This we would probably change when we figure out how we are actually authenticating them if (string.IsNullOrEmpty(PhoneNumber)) this.PhoneNumberConfirmed = false; }
public static string ToRole(IdentityTypes type) { switch (type) { case IdentityTypes.Admin: return(Administrator); case IdentityTypes.Contributor: return(Contributor); case IdentityTypes.Regular: return(Regular); default: throw new NotImplementedException(); } }
public static string IdentityTypeToElbaString(IdentityTypes identityType) { switch (identityType) { case IdentityTypes.BeraterId: return("Berater-ID"); case IdentityTypes.FirmenId: return("Firmen-ID"); case IdentityTypes.IfpIdBeauftragter: return("IFP-ID-BEAUF"); case IdentityTypes.IfpIdFirma: return("IFP-ID-Firma"); } return(string.Empty); }
private async Task <IActionResult> CreateNewAccount(CreateIdentityDto dto, IdentityTypes type) { if (!ModelState.IsValid) { return(BadRequest()); } var result = await _identityService.Save( dto.Username, dto.Email, type); if (result.Type == SaveIdentityResult.ResultType.Ok) { return(Ok(Dtos.Envelope.AsSuccess())); } return(Ok(Dtos.Envelope.AsFailure((uint)result.Type))); }
private async Task <SaveIdentityResult> Create( string username, string email, string password1, string password2, IdentityTypes type) { username.CheckIfNull(nameof(username)); email.CheckIfNull(nameof(email)); password1.CheckIfNull(nameof(password1)); password2.CheckIfNull(nameof(password2)); if (!Regex.IsMatch(email, EmailPattern, RegexOptions.IgnoreCase)) { return(SaveIdentityResult.As(InvalidEmailPattern)); } if (password1 != password2) { return(SaveIdentityResult.As(PasswordsDontMatch)); } if (await _identityRepository.ExistsByUsername(username)) { return(SaveIdentityResult.As(ExistingUsername)); } if (await _identityRepository.ExistsByEmail(email)) { return(SaveIdentityResult.As(ExistingEmail)); } var identity = new Identity { Username = username, Email = email, IdType = type, Password = _cryptoManager.HashPassword(password1), SecurityStamp = Guid.NewGuid().ToString() }; await _identityRepository.Save(identity); return(SaveIdentityResult.Create(identity, Ok)); }
protected User(RegistrationModelBase model) { this.UserName = model.UserName; this.Email = model.Email; this.PhoneNumber = model.PhoneNumber; this.Type = model.Type; // FIXME: We need to do something about this // Emails need to be verified if (string.IsNullOrEmpty(Email)) { this.EmailConfirmed = false; } //FIXME: This we would probably change when we figure out how we are actually authenticating them if (string.IsNullOrEmpty(PhoneNumber)) { this.PhoneNumberConfirmed = false; } }
protected void LoadEntities() { Addresses.Load(); Cathedras.Load(); Citizenships.Load(); CommandPermissions.Load(); Commands.Load(); Countries.Load(); Directions.Load(); DisciplineCycles.Load(); Disciplines.Load(); Districts.Load(); EducationCompetences.Load(); EducationForms.Load(); EducationLevels.Load(); EducationPlanCompoments.Load(); EducationPlanGraphics.Load(); EducationPlanItems.Load(); EducationPlans.Load(); EducationProgramTypes.Load(); EducationStandartTypes.Load(); Faculties.Load(); FinanceSources.Load(); Genders.Load(); Groups.Load(); IdentityDocuments.Load(); IdentityOrganizations.Load(); IdentityTypes.Load(); InterfaceElements.Load(); InterfacePermissions.Load(); Localities.Load(); Persons.Load(); Regions.Load(); Roles.Load(); Streets.Load(); StudentStates.Load(); Students.Load(); Teachers.Load(); Towns.Load(); Users.Load(); }
public async Task <SaveIdentityResult> Save(string username, string email, string password1, string password2, IdentityTypes type) { var result = await Create(username, email, password1, password2, type); if (result.Type == Ok) { await _mediator.Publish(AccountCreated.From(result.Identity)); } return(result); }
public async Task <ResponseModel <IdentityTypes> > CreateIdentityType(IdentityTypes identityType) { ResponseModel <IdentityTypes> response = InitializeIdType(); return(await CreateRecord(identityType, response)); }
public async Task <IActionResult> PostIdentityTypes(IdentityTypes identityTypes) { var response = await _db.CreateIdentityType(identityTypes); return(_responsesService.PostResponse(response)); }
public async Task <ResponseModel <IdentityTypes> > UpdateIdentityType(int id, IdentityTypes identityType) { return(await CallUpdate <IdentityTypes>(id, identityType)); }
public async Task <ResponseModel <IdentityTypes> > CreateIdentityType(IdentityTypes identityType) { return(await CallCreate <IdentityTypes>(identityType)); }
public async Task <ResponseModel <IdentityTypes> > UpdateIdentityType(int id, IdentityTypes identityType) { ResponseModel <IdentityTypes> response = InitializeIdType(); _context.Entry(identityType).State = EntityState.Modified; return(await UpdateRecord(id, identityType, response)); }