public PartnerSkillDTO Insert(PartnerSkillDTO partnerSkillDTO) { try { using (OpenNosContext context = DataAccessHelper.CreateContext()) { PartnerSkill partnerSkill = new PartnerSkill(); if (Mapper.Mappers.PartnerSkillMapper.ToPartnerSkill(partnerSkillDTO, partnerSkill)) { context.PartnerSkill.Add(partnerSkill); context.SaveChanges(); PartnerSkillDTO dto = new PartnerSkillDTO(); if (Mapper.Mappers.PartnerSkillMapper.ToPartnerSkillDTO(partnerSkill, dto)) { return(dto); } } } } catch (Exception e) { Logger.Error(e); } return(null); }
public List <PartnerSkillDTO> LoadByEquipmentSerialId(Guid equipmentSerialId) { List <PartnerSkillDTO> partnerSkillDTOs = new List <PartnerSkillDTO>(); try { using (OpenNosContext context = DataAccessHelper.CreateContext()) { context.PartnerSkill.Where(s => s.EquipmentSerialId == equipmentSerialId).ToList() .ForEach(partnerSkill => { PartnerSkillDTO partnerSkillDTO = new PartnerSkillDTO(); if (Mapper.Mappers.PartnerSkillMapper.ToPartnerSkillDTO(partnerSkill, partnerSkillDTO)) { partnerSkillDTOs.Add(partnerSkillDTO); } }); } } catch (Exception e) { Logger.Error(e); } return(partnerSkillDTOs); }
public PartnerSkill(PartnerSkillDTO input) { PartnerSkillId = input.PartnerSkillId; EquipmentSerialId = input.EquipmentSerialId; SkillVNum = input.SkillVNum; Level = input.Level; }
public static bool ToPartnerSkill(PartnerSkillDTO input, PartnerSkill output) { if (input == null) { return(false); } output.PartnerSkillId = input.PartnerSkillId; output.EquipmentSerialId = input.EquipmentSerialId; output.SkillVNum = input.SkillVNum; output.Level = input.Level; return(true); }