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