public virtual ApiSaleTicketsServerResponseModel MapEntityToModel( SaleTickets item) { var model = new ApiSaleTicketsServerResponseModel(); model.SetProperties(item.Id, item.SaleId, item.TicketId); if (item.SaleIdNavigation != null) { var saleIdModel = new ApiSaleServerResponseModel(); saleIdModel.SetProperties( item.SaleIdNavigation.Id, item.SaleIdNavigation.IpAddress, item.SaleIdNavigation.Notes, item.SaleIdNavigation.SaleDate, item.SaleIdNavigation.TransactionId); model.SetSaleIdNavigation(saleIdModel); } if (item.TicketIdNavigation != null) { var ticketIdModel = new ApiTicketServerResponseModel(); ticketIdModel.SetProperties( item.TicketIdNavigation.Id, item.TicketIdNavigation.PublicId, item.TicketIdNavigation.TicketStatusId); model.SetTicketIdNavigation(ticketIdModel); } return(model); }
public virtual ApiTicketClientRequestModel MapServerResponseToClientRequest( ApiTicketServerResponseModel response) { var request = new ApiTicketClientRequestModel(); request.SetProperties( response.PublicId, response.TicketStatusId); return(request); }
public virtual ApiTicketServerResponseModel MapServerRequestToResponse( int id, ApiTicketServerRequestModel request) { var response = new ApiTicketServerResponseModel(); response.SetProperties(id, request.PublicId, request.TicketStatusId); return(response); }
public void MapEntityToModel() { var mapper = new DALTicketMapper(); Ticket item = new Ticket(); item.SetProperties(1, "A", 1); ApiTicketServerResponseModel response = mapper.MapEntityToModel(item); response.Id.Should().Be(1); response.PublicId.Should().Be("A"); response.TicketStatusId.Should().Be(1); }
public virtual ApiTicketServerResponseModel MapEntityToModel( Ticket item) { var model = new ApiTicketServerResponseModel(); model.SetProperties(item.Id, item.PublicId, item.TicketStatusId); if (item.TicketStatusIdNavigation != null) { var ticketStatusIdModel = new ApiTicketStatusServerResponseModel(); ticketStatusIdModel.SetProperties( item.TicketStatusIdNavigation.Id, item.TicketStatusIdNavigation.Name); model.SetTicketStatusIdNavigation(ticketStatusIdModel); } return(model); }
public virtual async Task <UpdateResponse <ApiTicketServerResponseModel> > Update( int id, ApiTicketServerRequestModel model) { var validationResult = await this.TicketModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { Ticket record = this.DalTicketMapper.MapModelToEntity(id, model); await this.TicketRepository.Update(record); record = await this.TicketRepository.Get(id); ApiTicketServerResponseModel apiModel = this.DalTicketMapper.MapEntityToModel(record); await this.mediator.Publish(new TicketUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiTicketServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiTicketServerResponseModel> .UpdateResponse(validationResult)); } }
public void SetTicketIdNavigation(ApiTicketServerResponseModel value) { this.TicketIdNavigation = value; }
public TicketUpdatedNotification(ApiTicketServerResponseModel record) { this.Record = record; }