public void Update(ShareLogInfoModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } using (var db = new BaseDatabaseContext()) { var oldEntity = db.ShareLogInfos.Find(model.Id); if (oldEntity == null) { throw new Exception("oldEntity is null"); } oldEntity = model.ToEntity(oldEntity); db.SaveChanges(); } }
public static ShareLogInfo ToEntity(this ShareLogInfoModel model, ShareLogInfo destination) { return(model.MapTo(destination)); }
public static ShareLogInfo ToEntity(this ShareLogInfoModel model) { return(model.MapTo <ShareLogInfoModel, ShareLogInfo>()); }