stylist / backend / Stylist.Web / Controllers / ServicesController.cs
ServicesController.cs
Raw
using Microsoft.AspNetCore.Mvc;
using Stylist.Domain.Repositories.Interfaces;

namespace Stylist.Web.Controllers
{
    public class ServicesController : ApiController
    {
        private readonly IServiceRepository _serviceRepository;
        public ServicesController(IServiceRepository serviceRepository)
        {
            _serviceRepository = serviceRepository;
        }

        [HttpGet(ApiEndpoints.Services.GetRecommendedBySalonId)]
        public async Task<IActionResult> GetRecommendedServicesBySalonAsync([FromRoute] int salonId)
        {
            return Ok(await _serviceRepository.GetRecommendedServicesBySalonAsync(salonId));
        }

        [HttpGet(ApiEndpoints.Services.GetBySalonId)]
        public async Task<IActionResult> GetServicesBySalonAsync([FromRoute] int salonId)
        {
            return Ok(await _serviceRepository.GetServicesBySalonAsync(salonId));
        }
    }
}