コード例 #1
0
        public int?Add(TechnologyBusinessModel technology)
        {
            var technologyEntity = TechnologyBusinessModelToEntity(technology);

            if (technologyEntity != null)
            {
                _context.Add(technologyEntity);
                return(technologyEntity.TechnologyId);
            }
            return(null);
        }
コード例 #2
0
        public int?Update(TechnologyBusinessModel technology)
        {
            var technologyEntity = TechnologyBusinessModelToEntity(technology);

            if (technologyEntity != null)
            {
                var existingTechnology = GetTechnologyById(technology.TechnologyId);
                technologyEntity.CreatedDate = existingTechnology.CreatedDate;
                _context.Update(technologyEntity);
                return(technologyEntity.TechnologyId);
            }
            return(null);
        }
コード例 #3
0
 private Technology TechnologyBusinessModelToEntity(TechnologyBusinessModel technology)
 {
     if (technology == null)
     {
         return(null);
     }
     return(new Technology
     {
         TechnologyId = technology.TechnologyId,
         TechnologyName = technology.TechnologyName,
         Description = technology.Description,
         CreatedBy = technology.CreatedBy,
         CreatedDate = technology.CreatedDate,
         ModifiedBy = technology.ModifiedBy,
         ModifiedDate = technology.ModifiedDate,
         IsActive = technology.IsActive
     });
 }