private static bool map(PartnerSkills input, PartnerSkillsDTO output) { if (input == null) { output = null; return(false); } Mapper.Mappers.PartnerSkillsMapper.ToPartnerSkillsDTO(input, output); return(true); }
protected static PartnerSkillsDTO InsertOrUpdate(OpenNosContext context, PartnerSkillsDTO dto) { try { PartnerSkills entity = context.PartnerSkills.FirstOrDefault(c => c.PartnerVnum == dto.PartnerVnum); return(entity == null?Insert(dto, context) : Update(entity, dto, context)); } catch (Exception e) { Logger.Error(e); return(null); } }
protected static PartnerSkillsDTO Update(PartnerSkills entity, PartnerSkillsDTO inventory, OpenNosContext context) { if (entity != null) { map(inventory, entity); context.SaveChanges(); } if (map(entity, inventory)) { return(inventory); } return(null); }
public virtual DeleteResult Delete(long id) { using (OpenNosContext context = DataAccessHelper.CreateContext()) { PartnerSkills entity = context.Set <PartnerSkills>().FirstOrDefault(i => i.PartnerVnum == id); if (entity != null) { context.Set <PartnerSkills>().Remove(entity); context.SaveChanges(); } return(DeleteResult.Deleted); } }
protected static PartnerSkillsDTO Insert(PartnerSkillsDTO dto, OpenNosContext context) { PartnerSkills entity = new PartnerSkills(); map(dto, entity); context.Set <PartnerSkills>().Add(entity); context.SaveChanges(); if (map(entity, dto)) { return(dto); } return(null); }
public static bool ToPartnerSkills(PartnerSkillsDTO input, PartnerSkills output) { if (input == null) { output = null; return(false); } output.PartnerVnum = input.PartnerVnum; output.FirstSkill = input.FirstSkill; output.SecondSkill = input.SecondSkill; output.ThirdSkill = input.ThirdSkill; output.SpecialBuffId = input.SpecialBuffId; output.IdentifierKey = input.IdentifierKey; return(true); }