/// <summary> /// Get the customers who made the most calls to the service center /// </summary> /// <returns>List of most calling customer if succeeded otherwise null</returns> public List <MostCallCustomerDTO> GetMostCallingToCenterCustomers() { List <Customer> customers; List <MostCallCustomerDTO> customersDTO = null; try { customers = _unitOfWork.Customer.GetMostCallToCenterCustomers(DateTime.Now); } catch (Exception e) { _logger.Log($"{Messages.messageFor[MessageType.GeneralDbFaild]} Execption details: {e.Message}"); throw new FaildToConnectDbExeption(Messages.messageFor[MessageType.GeneralDbFaild]); } if (customers != null) { customersDTO = new List <MostCallCustomerDTO>(); foreach (var customer in customers) { MostCallCustomerDTO customerDTO = CreateMostCallModel(customer); customersDTO.Add(customerDTO); } } return(customersDTO); }
/// <summary> /// Create most call model /// </summary> /// <param name="customer">Customer model</param> /// <returns>MostCallCustomerDTO model</returns> private MostCallCustomerDTO CreateMostCallModel(Customer customer) { MostCallCustomerDTO customerDTO = new MostCallCustomerDTO(); customerDTO.FirstName = customer.FirstName; customerDTO.LastName = customer.LastName; customerDTO.IdentityCard = customer.IdentityCard; customerDTO.CallsToCenter = customer.CallsToCenter; return(customerDTO); }