public Organisation CreateOrganisation(string name, string bannerUrl, User organisator) { Organisation organisation = new Organisation { Name = name, BannerUrl = bannerUrl, DashboardBlocks = new List <DashboardBlock>(), Playlists = new List <Playlist>(), }; return(organisationsRepository.CreateOrganisation(organisation, organisator)); }
public async Task<Unit> Handle(MigrateContactOrganisationRequest request, CancellationToken cancellationToken) { var newOrganisationCreated = false; var requestContact = request.Contact; var requestOrganisation = request.Organisation; if (requestContact != null ) { var organisationId = Guid.Empty; if (requestOrganisation != null) { var organisation = await _organisationRepository.GetOrganisationByName(requestOrganisation.Name) ?? (await _organisationRepository.GetOrganisationByName(requestOrganisation.OrganisationDetails.LegalName) ?? await _organisationRepository.GetOrganisationByName(requestOrganisation.OrganisationDetails.ProviderName)); if (organisation != null) { //Update organisation details organisation.OrganisationDetails = requestOrganisation.OrganisationDetails; await _organisationRepository.UpdateOrganisation(organisation); organisationId = organisation.Id; } else { //Create new organisation organisationId = await _organisationRepository.CreateOrganisation(requestOrganisation); newOrganisationCreated = true; } } var signinId = requestContact.SigninId ?? Guid.Empty; var contact = await _contactRepository.GetContactBySignInId(signinId); if (contact != null) { //Update organisation association if(contact.ApplyOrganisationId == null && organisationId != Guid.Empty) await _contactRepository.UpdateApplyOrganisationId(requestContact.Id, organisationId); } else { //Create new contact Contact newContact = null; if (organisationId == Guid.Empty) newContact = await _contactRepository.CreateContact(requestContact,null); else newContact = await _contactRepository.CreateContact(requestContact, organisationId); if (newOrganisationCreated) await _organisationRepository.UpdateOrganisation(organisationId, newContact.Id); } } return Unit.Value; }
private async Task <Organisation> CreateNewOrganisation(ManageOrganisationRequest request) { var organisation = new Organisation { Status = "New", CreatedBy = request.CreatedBy.ToString(), Name = request.Name, OrganisationDetails = request.OrganisationDetails, OrganisationType = request.OrganisationType, OrganisationUkprn = request.OrganisationUkprn, RoATPApproved = request.RoATPApproved }; organisation.Id = await _organisationRepository.CreateOrganisation(organisation, request.CreatedBy); return(organisation); }
public async Task <OrganisationDto> CreateOrganisation(OrganisationDto organisationDto, string userId) { var organisation = new Organisations { Active = true, Address = organisationDto.Address, Comments = organisationDto.Comments, ContactEmail = organisationDto.Email, ContactPhone = organisationDto.Phone, CreatedBy =, CreatedOn = DateTimeHelper.Instance.GetCurrentDate(), Description = organisationDto.Description, LastActivityType = "I", Name = organisationDto.Name }; _organisationResposiory.CreateOrganisation(organisation); await _organisationResposiory.SaveAsync(); return(organisationDto); } }
private Domain.Organisation.Organisation AddOrganisation(Domain.Organisation.Organisation organisation) { Validate(organisation); return(_organisationRepository.CreateOrganisation(organisation)); }
public ActionResult <int> CreateOrganisation(Organisation organisation) { int numberOfAffectedRows = _repository.CreateOrganisation(organisation); return(Ok(numberOfAffectedRows)); }