public void SaveData(ModelNotifiedForCustomerDemographics modelNotifiedForCustomerDemographics, out string error) { CustomerDemographicsBsn bsn = new CustomerDemographicsBsn(wpfConfig); CustomerDemographicsInfo dbItem = new CustomerDemographicsInfo(); Cloner.CopyAllTo(typeof(ModelNotifiedForCustomerDemographics), modelNotifiedForCustomerDemographics, typeof(CustomerDemographicsInfo), dbItem); bsn.UpdateOne(dbItem, out error); }
public void TryUpdate(UpdateCustomerDemographicsView viewToUpdate, out RestExceptionError error) { error = null; CustomerDemographicsInfo dbViewToInclude = new CustomerDemographicsInfo(); try { Cloner.CopyAllTo(typeof(UpdateCustomerDemographicsView), viewToUpdate, typeof(CustomerDemographicsInfo), dbViewToInclude); } catch (Exception ex) { error = new RestExceptionError(); error.InternalMessage = "Internal Error parsing data for (CustomerDemographics.TryUpdate/Parsing)"; error.ExceptionMessage = ex.Message; error.SourceError = RestExceptionError._SourceError.ServerSide; error.StackTrace = ex.StackTrace; } try { CustomerDemographicsBsn bsn = new CustomerDemographicsBsn(restConfig); string dbError = null; bsn.UpdateOne(dbViewToInclude, out dbError); if (dbError != null) { error = new RestExceptionError(); error.InternalMessage = "Internal Error Save data for [CustomerDemographics.TryUpdate]"; error.ExceptionMessage = dbError; error.SourceError = RestExceptionError._SourceError.ServerSide; error.StackTrace = ""; } } catch (Exception ex) { error = new RestExceptionError(); error.InternalMessage = "Internal Error Update data for [CustomerDemographics.TryUpdate]"; error.ExceptionMessage = ex.Message; error.SourceError = RestExceptionError._SourceError.ServerSide; error.StackTrace = ex.StackTrace; } }