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