/// <summary> /// override update service to include status log /// </summary> /// <param name="agent"></param> /// <param name="commit"></param> /// <param name="modifiedBy"></param> /// <returns></returns> public override async Task <bool> UpdateAsync(Agent agent, bool commit = true, int?modifiedBy = null) { var oldAgent = await this.GetAsync(agent.ID); //status log await _statusLogService.LogStatusAsync(oldAgent, agent, nameof(agent.IsActive), agent.Remark, (int)modifiedBy); //Update Address Information var addressSaved = await _addressService.UpdateAsync(agent.Address); var result = addressSaved ? await base.UpdateAsync(agent, commit): false; return(result); }
public override async Task <bool> UpdateAsync(Supplier supplier, bool commit = true, int?modifiedBy = null) { var oldSupplier = await this.GetAsync(supplier.ID); await _statusLogService.LogStatusAsync(oldSupplier, supplier, nameof(supplier.IsActive), supplier.Remark, (int)modifiedBy); //Update Address Information First var addressSaved = await _addressService.UpdateAsync(supplier.Address); var result = addressSaved? await base.UpdateAsync(supplier, commit): false; return(result); }