public void AddData(ModelNotifiedForEmployees modelNotifiedForEmployees, out string error) { EmployeesBsn bsn = new EmployeesBsn(wpfConfig); EmployeesInfo dbItem = new EmployeesInfo(); Cloner.CopyAllTo(typeof(ModelNotifiedForEmployees), modelNotifiedForEmployees, typeof(EmployeesInfo), dbItem); bsn.InsertOne(dbItem, out error); modelNotifiedForEmployees.NewItem = false; Cloner.CopyAllTo(typeof(EmployeesInfo), dbItem, typeof(ModelNotifiedForEmployees), modelNotifiedForEmployees); }
public void TryInclude(CreateEmployeesView viewToInclude, out RestExceptionError error) { error = null; EmployeesInfo dbViewToInclude = new EmployeesInfo(); try { Cloner.CopyAllTo(typeof(CreateEmployeesView), viewToInclude, typeof(EmployeesInfo), dbViewToInclude); } catch (Exception ex) { error = new RestExceptionError(); error.InternalMessage = "Internal Error parsing data for (Employees.TryInclude/Parsing)"; error.ExceptionMessage = ex.Message; error.SourceError = RestExceptionError._SourceError.ServerSide; error.StackTrace = ex.StackTrace; } try { EmployeesBsn bsn = new EmployeesBsn(restConfig); string dbError = null; bsn.InsertOne(dbViewToInclude, out dbError); if (dbError != null) { error = new RestExceptionError(); error.InternalMessage = "Internal Error Save data for [Employees.TryInclude/Save]"; error.ExceptionMessage = dbError; error.SourceError = RestExceptionError._SourceError.ServerSide; error.StackTrace = ""; } } catch (Exception ex) { error = new RestExceptionError(); error.InternalMessage = "Internal Error Save data for [Employees.TryInclude/Save]"; error.ExceptionMessage = ex.Message; error.SourceError = RestExceptionError._SourceError.ServerSide; error.StackTrace = ex.StackTrace; } }