public DictionaryDto getByKey(string key) { Dictionary dictionary = dictionaryDAL.getByKey(key); Mapper.Initialize(cfg => { cfg.CreateMap <Dictionary, DictionaryDto>(); }); DictionaryDto dictionaryDto = Mapper.Map <DictionaryDto>(dictionary); return(dictionaryDto); }
public DictionaryDto update(DictionaryDto dictionaryDto, int updateUserId) { Dictionary dictionary = dictionaryDAL.getByKey(dictionaryDto.Key); dictionary.Value = dictionaryDto.Value; if (dictionaryDAL.update(dictionary) > 0) { Mapper.Initialize(cfg => { cfg.CreateMap <Dictionary, DictionaryDto>(); }); return(Mapper.Map <DictionaryDto>(dictionary)); } else { return(null); } }