Skip to content

Instantly share code, notes, and snippets.

@demofan
Created July 31, 2015 12:58
Show Gist options
  • Save demofan/3e7185c3c44bad5fa75a to your computer and use it in GitHub Desktop.
Save demofan/3e7185c3c44bad5fa75a to your computer and use it in GitHub Desktop.
public void Update(Article data)
{
var oldData = GetSingleData(data.Id);
if (oldData != null)
{
Mapper.CreateMap<Article, Article>()
.ForMember(d => d.CreateTime, d => d.Ignore())
.ForMember(d => d.LastEditTime, d => d.UseValue(DateTime.UtcNow));
// oldData.Subject = data.Subject;
oldData = Mapper.Map<Article>(data);
Save();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment