public MA_BOND_MARKET UpdateBondMarket(SessionInfo sessioninfo, MA_BOND_MARKET market) { using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { var checkDuplicate = unitOfWork.MA_BOND_MARKETRepository.GetAll().FirstOrDefault(p => p.LABEL.ToLower().Equals(market.LABEL.ToLower()) && p.ID != market.ID); if (checkDuplicate != null) { throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA); } var foundMarket = unitOfWork.MA_BOND_MARKETRepository.All().FirstOrDefault(p => p.ID == market.ID); if (foundMarket == null) { throw this.CreateException(new Exception(), Messages.DATA_NOT_FOUND); } else { foundMarket.LABEL = market.LABEL; foundMarket.DESCRIPTION = market.DESCRIPTION; unitOfWork.Commit(); } } return(market); }
public static object UpdateBondMarket(SessionInfo sessioninfo, MA_BOND_MARKET record) { try { LookupBusiness _lookupbusiness = new LookupBusiness(); record.LABEL = record.LABEL.ToUpper(); record.DESCRIPTION = record.DESCRIPTION.ToUpper(); var updated = _lookupbusiness.UpdateBondMarket(sessioninfo, record); return(new { Result = "OK" }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public MA_BOND_MARKET CreateBondMarket(SessionInfo sessioninfo, MA_BOND_MARKET market) { using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { var checkDuplicate = unitOfWork.MA_BOND_MARKETRepository.GetAll().FirstOrDefault(p => p.LABEL.ToLower().Equals(market.LABEL.ToLower())); if (checkDuplicate != null) { throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA); } unitOfWork.MA_BOND_MARKETRepository.Add(market); unitOfWork.Commit(); } return(market); }
public static object Update(MA_BOND_MARKET record) { return(LookupUIP.UpdateBondMarket(SessionInfo, record)); }