public bool DealerTypeExists(DealerType dealerType) { try { return(_ctx.DealerTypes.Any(c => c.DealerTypeName == dealerType.DealerTypeName && c.DealerTypeId != dealerType.DealerTypeId)); } catch (Exception ex) { _logger.LogError($"Failed in DealerTypeExists: {ex}"); return(false); } }
public Dealer(string tpCode, string phone, string address, string contactName, string name, string ruc, int maxCashiers, DealerType type) { TPCode = tpCode; Phone = phone; Address = address; ContactName = contactName; Name = name; Ruc = ruc; MaxCashiers = maxCashiers; Type = type; Status = Status.Active; }
public DealerType CreateDealerType(DealerType dealerType, int userId = -1) { try { var dealerTypeEntityEntry = _ctx.DealerTypes.Add(dealerType); if (!Save(userId)) { return(null); } return(dealerTypeEntityEntry.Entity); } catch (Exception ex) { _logger.LogError($"Failed in CreateDealerType: {ex}"); return(null); } }
public DealerType GetDealerType(int dealerTypeId, string propertyToInclude = null) { try { DealerType dealerType = null; if (!String.IsNullOrEmpty(propertyToInclude)) { dealerType = _ctx.DealerTypes.Include(propertyToInclude) .Where(c => c.DealerTypeId == dealerTypeId) .FirstOrDefault(); } dealerType = _ctx.DealerTypes .Where(c => c.DealerTypeId == dealerTypeId).FirstOrDefault(); return(dealerType); } catch (Exception ex) { _logger.LogError($"Failed in GetDealerType: {ex}"); return(null); } }
public DealerType UpdateDealerType(int dealerTypeId, DealerType dealerType, int userId = -1) { try { var existingDealerType = GetDealerType(dealerTypeId); _ctx.Entry(existingDealerType).CurrentValues.SetValues(dealerType); _ctx.Entry(existingDealerType).Property(x => x.AdmCreated).IsModified = false; _ctx.Entry(existingDealerType).Property(x => x.AdmCreatedBy).IsModified = false; var dealerTypeEntityEntry = _ctx.Entry(existingDealerType); if (!Save(userId)) { return(null); } return(dealerTypeEntityEntry.Entity); } catch (Exception ex) { _logger.LogError($"Failed in UpdateDealerType: {ex}"); return(null); } }
public CanadianLocatorResult(DealerType dealerType) { this.dealerType = dealerType; }