public int?Add(TechnologyBusinessModel technology) { var technologyEntity = TechnologyBusinessModelToEntity(technology); if (technologyEntity != null) { _context.Add(technologyEntity); return(technologyEntity.TechnologyId); } return(null); }
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); }
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 }); }