public virtual void IsPropChanged(EventStudent<string> e) { if (null != this.handleEvent) { this.handleEvent(this, e); } }
public async Task <IActionResult> Edit(int id, [Bind("StudentId,EventId")] EventStudent eventStudent) { if (id != eventStudent.EventId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(eventStudent); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventStudentExists(eventStudent.EventId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EventId"] = new SelectList(_context.Events, "EventID", "EventID", eventStudent.EventId); ViewData["EventId"] = new SelectList(_context.Students, "StudentID", "Address", eventStudent.EventId); return(View(eventStudent)); }
public void MapModelToEntity() { var mapper = new DALEventStudentMapper(); ApiEventStudentServerRequestModel model = new ApiEventStudentServerRequestModel(); model.SetProperties(1, 1); EventStudent response = mapper.MapModelToEntity(1, model); response.EventId.Should().Be(1); response.StudentId.Should().Be(1); }
public void MapEntityToModel() { var mapper = new DALEventStudentMapper(); EventStudent item = new EventStudent(); item.SetProperties(1, 1, 1); ApiEventStudentServerResponseModel response = mapper.MapEntityToModel(item); response.EventId.Should().Be(1); response.Id.Should().Be(1); response.StudentId.Should().Be(1); }
public void GetStudentDataButton(string studentID) { studentID = StudentIDInput.text; EventStudent eventData = new EventStudent(); eventData.eventName = "GetStudentData"; eventData.data = new StudentData(studentID); string toJson = JsonUtility.ToJson(eventData); ws.Send(toJson); }
public void MapEntityToModelList() { var mapper = new DALEventStudentMapper(); EventStudent item = new EventStudent(); item.SetProperties(1, 1, 1); List <ApiEventStudentServerResponseModel> response = mapper.MapEntityToModel(new List <EventStudent>() { { item } }); response.Count.Should().Be(1); }
public virtual EventStudent MapModelToEntity( int id, ApiEventStudentServerRequestModel model ) { EventStudent item = new EventStudent(); item.SetProperties( id, model.EventId, model.StudentId); return(item); }
public async Task <IActionResult> Create([Bind("StudentId,EventId")] EventStudent eventStudent) { if (ModelState.IsValid) { _context.Add(eventStudent); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EventId"] = new SelectList(_context.Events, "EventID", "EventID", eventStudent.EventId); ViewData["EventId"] = new SelectList(_context.Students, "StudentID", "Address", eventStudent.EventId); return(View(eventStudent)); }
public virtual async Task <ApiEventStudentServerResponseModel> Get(int id) { EventStudent record = await this.EventStudentRepository.Get(id); if (record == null) { return(null); } else { return(this.DalEventStudentMapper.MapEntityToModel(record)); } }
public virtual async Task <CreateResponse <ApiEventStudentServerResponseModel> > Create( ApiEventStudentServerRequestModel model) { CreateResponse <ApiEventStudentServerResponseModel> response = ValidationResponseFactory <ApiEventStudentServerResponseModel> .CreateResponse(await this.EventStudentModelValidator.ValidateCreateAsync(model)); if (response.Success) { EventStudent record = this.DalEventStudentMapper.MapModelToEntity(default(int), model); record = await this.EventStudentRepository.Create(record); response.SetRecord(this.DalEventStudentMapper.MapEntityToModel(record)); await this.mediator.Publish(new EventStudentCreatedNotification(response.Record)); } return(response); }
public virtual ApiEventStudentServerResponseModel MapEntityToModel( EventStudent item) { var model = new ApiEventStudentServerResponseModel(); model.SetProperties(item.Id, item.EventId, item.StudentId); if (item.EventIdNavigation != null) { var eventIdModel = new ApiEventServerResponseModel(); eventIdModel.SetProperties( item.EventIdNavigation.Id, item.EventIdNavigation.ActualEndDate, item.EventIdNavigation.ActualStartDate, item.EventIdNavigation.BillAmount, item.EventIdNavigation.EventStatusId, item.EventIdNavigation.ScheduledEndDate, item.EventIdNavigation.ScheduledStartDate, item.EventIdNavigation.StudentNotes, item.EventIdNavigation.TeacherNotes); model.SetEventIdNavigation(eventIdModel); } if (item.StudentIdNavigation != null) { var studentIdModel = new ApiStudentServerResponseModel(); studentIdModel.SetProperties( item.StudentIdNavigation.Id, item.StudentIdNavigation.Birthday, item.StudentIdNavigation.Email, item.StudentIdNavigation.EmailRemindersEnabled, item.StudentIdNavigation.FamilyId, item.StudentIdNavigation.FirstName, item.StudentIdNavigation.IsAdult, item.StudentIdNavigation.LastName, item.StudentIdNavigation.Phone, item.StudentIdNavigation.SmsRemindersEnabled, item.StudentIdNavigation.UserId); model.SetStudentIdNavigation(studentIdModel); } return(model); }
public async void Get_ShouldReturnRecords() { var mock = new ServiceMockFacade <IEventStudentService, IEventStudentRepository>(); var record = new EventStudent(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record)); var service = new EventStudentService(mock.LoggerMock.Object, mock.MediatorMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.EventStudentModelValidatorMock.Object, mock.DALMapperMockFactory.DALEventStudentMapperMock); ApiEventStudentServerResponseModel response = await service.Get(default(int)); response.Should().NotBeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public virtual async Task <UpdateResponse <ApiEventStudentServerResponseModel> > Update( int id, ApiEventStudentServerRequestModel model) { var validationResult = await this.EventStudentModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { EventStudent record = this.DalEventStudentMapper.MapModelToEntity(id, model); await this.EventStudentRepository.Update(record); record = await this.EventStudentRepository.Get(id); ApiEventStudentServerResponseModel apiModel = this.DalEventStudentMapper.MapEntityToModel(record); await this.mediator.Publish(new EventStudentUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiEventStudentServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiEventStudentServerResponseModel> .UpdateResponse(validationResult)); } }
public override string ToString() { return(EventStudent.ToString() + "\n" + WhatCall + "\n" + CollectionName + "\n" + KeyChanged); }