public void InsertDataStaffTest() { InsertDataStaffRequest request = new InsertDataStaffRequest(); request.Staff = _staffValidData; InsertDataStaffResponse response = _staffService.InsertDataStaff(request); Assert.IsTrue(response.Messages.Count == 0, "Failed insert data"); }
public InsertDataStaffResponse InsertDataStaff(InsertDataStaffRequest request) { InsertDataStaffResponse response = new InsertDataStaffResponse(); try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted })) { _staffRepo.Add(request.Staff); transScope.Complete(); } } catch (Exception ex) { throw new Exception(ex.ToString()); } return(response); }