コード例 #1
0
 public static GasStation ToContract(this Entities.GasStation domain)
 => new GasStation
 {
     Id                   = domain.Id,
     Name                 = domain.Name,
     AddressLine1         = domain.AddressLine1,
     AddressLine2         = domain.AddressLine2,
     CreatedByUserId      = domain.CreatedByUserId,
     LastModifiedByUserId = domain.ModifiedByUserId,
     LastModifiedAt       = domain.LastModified,
     ManagedBySystem      = domain.MaintainedBySystem,
     FranchiseId          = domain.FranchiseId
 };
コード例 #2
0
        public async Task <long> Create(AddGasStationModel model)
        {
            var gasStation = new Entities.GasStation(
                name: model.Name,
                addressLine1: model.AddressLine1,
                addressLine2: model.AddressLine2,
                franchiseId: model.FranchiseId,
                maintainedBySystem: false,
                websiteAddress: model.WebsiteAddress);

            auditMetadataProvider.AddAuditMetadataToNewEntity(gasStation);
            dbContext.GasStations.Add(gasStation);
            await dbContext.SaveChangesAsync();

            return(gasStation.Id);
        }