using Microsoft.AspNetCore.Mvc;

using Microsoft.Extensions.Logging;

using System;

using System.Collections.Generic;

using System.Threading.Tasks;

using System.Linq;

using MyApp.Models;

using MyApp.Services;

using MyApp.Dtos;

namespace MyApp.Controllers

{

    [ApiController]

    [Route(“api/[controller]”)]

    public class CustomerController : ControllerBase

    {

        private readonly ICrmService _crmService;

        private readonly ILogger<CustomerController> _logger;

        public CustomerController(ICrmService crmService, ILogger<CustomerController>logger)

        {

            _crmService = crmService;

            _logger = logger;

        }

        // GET: api/customer

        [HttpGet]

        public async Task<IActionResult> GetCustomers(

            [FromQuery] string status = null,

            [FromQuery] string search = null,

            [FromQuery] int page = 1,

            [FromQuery] int pageSize = 20)

        {

            _logger.LogInformation(“Fetching customers – Page {Page}, PageSize

{PageSize}, Status: {Status}, Search: {Search}”,

                page, pageSize, status, search);

            try

            {

                var customers = await _crmService.GetCustomersAsync();

                if (!string.IsNullOrEmpty(status))

                {

                    customers = customers.Where(c => string.Equals(c.Status, status, StringComparison.OrdinalIgnoreCase));

                }

                if (!string.IsNullOrEmpty(search))

                {

                    customers = customers.Where(c =>

                        c.FullName.Contains(search, StringComparison.OrdinalIgnoreCase) ||

E
m
p
o
w
e
r
i
n
g
B
u
s
i
n
e
s
s
e
s

w
i
t
h
S
c
a
l
a
b
l
e
a
n
d
S
e
c
u
r
e

.
N
E
T

S
o
l
u
t
i
o
n
s
E
m
p
o
w
e
r
i
n
g

B
u
s
i
n
e
s
s
e
s

w
i
t
h

S
c
a
l
a
b
l
e

a
n
d
S
e
c
u
r
e

.
N
E
T

S
o
l
u
t
i
o
n
s

At Clarity Technologies, we specialize in delivering robust, scalable, and secure applications using the Microsoft .NET framework. Our team of experienced developers leverages the latest technologies to build custom solutions that drive business growth and efficiency.

We create “Awesome"

As technology consultants, we deliver exceptional results through innovative and creative solutions that drive business success and exceed client expectations. Our dedication to excellence and meticulous attention to detail consistently turn challenges into opportunities for growth and improved efficiency.

We take a comprehensive, client-focused approach to problem-solving—tailored to understand and address each organization’s unique needs—while ensuring delivery on time and within budget.

Application Support

We offer comprehensive application support to ensure your custom software runs smoothly and efficiently.

Software Engineering

We create solutions to meet your unique business requirements, ensuring scalability and efficiency.

Cloud Services

We design and implement robust, scalable infrastructure solutions, site to site connectivity, failover, and disaster plans.

Industry Knowledge + Experience = Smarter Solutions

Our consultants know your industry inside and out. That means less time getting up to speed and more time solving problems. At Clarity Technologies, we use our broad industry experience to deliver smart, tailored solutions that help your business grow and innovate.

Social Media

Your Heading Text
Your Heading Text
Your Heading Text
Your Heading Text