public ImportStaffDC GetImportStaff(string userName, string currentUserName, string appID, string overrideID, string code, IRepository <ImportStaff> dataRepository, IUnitOfWork uow) { try { using (uow) { Guid codeGuid = Guid.Parse(code); ImportStaff dataEntity = dataRepository.Single(x => x.Code == codeGuid); ImportStaffDC destination = Mapper.Map <ImportStaff, ImportStaffDC>(dataEntity); return(destination); } } catch (Exception e) { //Prevent exception from propogating across the service interface ExceptionManager.ShieldException(e); return(null); } }
public void CreateImportStaff(string userName, string currentUserName, string appID, string overrideID, ImportStaffDC dc, IRepository <ImportStaff> dataRepository, IUnitOfWork uow) { try { using (uow) { ImportStaff destination = Mapper.Map <ImportStaffDC, ImportStaff>(dc); dataRepository.Add(destination); uow.Commit(); } } catch (Exception e) { //Prevent exception from propogating across the service interface ExceptionManager.ShieldException(e); } }
public void CreateImportStaff(string userName, string currentUserName, string appID, string overrideID, ImportStaffDC dc) { IUnitOfWork uow = new UnitOfWork(); Repository <ImportStaff> dataRepository = new Repository <ImportStaff>(uow.ObjectContext); CreateImportStaff(userName, currentUserName, appID, overrideID, dc, dataRepository, uow); }