public async Task Register(CreateUserDTO input) { // Password Hashing string hashedPassword = Helpers.PasswordHelper.HashPassword(input.Password); input.Password = hashedPassword; // IsActive of new user is default false input.IsActive = false; // Create a new GuidKey (Confirmation Key) string GuidKey = Guid.NewGuid().ToString(); // Define GuidKey to Token input.Token = GuidKey; try { // Send an email for account confirmation Helpers.EmailHelper.SendMail(input.Email, GuidKey); var user = _mapper.Map <User>(input); user.Hash = input.Password; user.RoleName = ERole.Common.ToString(); await _userRepository.Create(user); } catch (Exception e) { throw e; } }
public async Task CreateBeacon(CreateBeaconDTO input) { var beacon = _mapper.Map <Beacon>(input); beacon.Artifact = await _artifactRepository.GetById(input.ArtifactId); await _beaconRepository.Create(beacon); }
public async Task CreateBuilding(CreateBuildingDTO input) { var building = _mapper.Map <Building>(input); building.Location = await _locationRepository.GetById(input.LocationId); await _buildingRepository.Create(building); }
public async Task CreateBeaconActivity(CreateBeaconActivityDTO input) { var beaconActivity = _mapper.Map <BeaconActivity>(input); beaconActivity.Beacon = await _beaconRepository.GetById(input.BeaconId); await _beaconActivityRepository.Create(beaconActivity); }
public async Task CreateFloor(CreateFloorDTO input) { var floor = _mapper.Map <Floor>(input); floor.Building = await _buildingRepository.GetById(input.BuildingId); //firstly you must get building with building ID await _repository.Create(floor); // and then you can push on create method }
public async Task CreateBeacon(CreateBeaconDTO input) { var beacon = _mapper.Map <Beacon>(input); beacon.Location = await _locationRepository.GetById(input.LocationId); await _beaconRepository.Create(beacon); }
public async Task CrateContent(CreateContentDTO input) { var content = _mapper.Map <Content>(input); content.Location = await _locationRepository.GetById(input.LocationId); await _repository.Create(content); }
public async Task CreateArtifact(CreateArtifactDTO input) { var artifact = _mapper.Map <Artifact>(input); artifact.RoomId = input.RoomId; artifact.LocationId = input.LocationId; await _artifactRepository.Create(artifact); }
public async Task CreateLocation(CreateLocationDTO input) { var location = _mapper.Map <Location>(input); location.Project = await _projectRepository.GetById(input.ProjectId); location.User = await _userRepository.GetById(input.UserId); await _repository.Create(location); }
/// <inheritdoc /> public Task <TEntity> Create(TEntity newEntity, bool modelState) { if (!modelState) { throw new MccBadRequestException("New entity does not have a valid model state"); } CheckEntityIsValid(newEntity); return(Repository.Create(newEntity)); }
public async Task CreateRelation(CreateRelationDTO input) { Relation relation = new Relation() { ArtifactId = input.ArtifactId, ContentId = input.ContentId, BeaconId = input.BeaconId, Proximity = (Proximity)Enum.Parse(typeof(Proximity), input.Proximity, true), }; relation.LocationId = input.LocationId; await _relationRepository.Create(relation); }
public async Task CreateRoom(CreateRoomDTO input) { var room = _mapper.Map <Room>(input); if (input.FloorId != Guid.Empty) { room.Floor = await _floorRepository.GetById(input.FloorId); } if (input.BeaconId != Guid.Empty) { room.Beacon = await _beaconRepository.GetById(input.BeaconId); } await _roomRepository.Create(room); }
public async Task CreateAnalytic(CreateAnalyticDTO input) { //Get Beacon for Major Minor and UUID. var beacon = await _beaconRepository.GetAll() .FirstOrDefaultAsync(x => x.Id == input.BeaconId); if (beacon != null) { Statistics result = new Statistics() { BeaconId = beacon.Id }; await _statisticRepository.Create(result); } else { return; } }
public async Task CreateProject(CreateProjectDTO input) { var project = _mapper.Map <Project>(input); await _repository.Create(project); }