C#C
C#9mo ago
Zee

✅ code cant find reference to my ID but I am implementing it correctly

Severity Code Description Project File Line Suppression State Details
Error CS0103 The name 'customers' does not exist in the current context PharmacyApp D:\Zeeshan\Documents\Pharmacy\PharmacyApp\Services\FeedbackFormService.cs 27 Active



using Microsoft.AspNetCore.Identity;
using PharmacyApp.Models;
using PharmacyApp.Repositories;
using PharmacyApp.ViewModels;

namespace PharmacyApp.Services
{
    public class FeedbackFormService : IFeedbackFormService<FeedBackFormViewModel>
    {
        private readonly IRepository<FeedbackForm> _repository;
        private readonly UserManager<IdentityUser> _userManager;


        public FeedbackFormService(IRepository<FeedbackForm> repository, UserManager<IdentityUser> userManager)
        { 
            _repository = repository;
            _userManager = userManager;
        }

        public async Task<FeedBackFormViewModel> CreateForm(FeedBackFormViewModel entity)
        {

            var model = new FeedbackForm
            {
                Title = entity.Title,
                Description = entity.Description,
                CustomerID = _userManager.GetUserId(customers)
            };

            // Add to repository
            await _repository.AddAsync(model);

            return entity;

        }
    }
}

there error is on this line

userID = _userManager.GetUserId(customers)

I checked my DI in program.cs its all right to me
Was this page helpful?