Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "expertit"

Hello,

I'm implementing the "step by step" for MVC Jquery. Everything is fine, page and entities, database migration, inital data feeding.

The problem is when I develop the test for the app service, everything is going well except that no entities are retrieved while in the DB there are records in the table.

In the DbContext

public virtual IDbSet<Subject> Subjects { get; set; }

The entity

    [Table("Subjects")]
    public class Subject : FullAuditedEntity
    {
        public const int MaxNameLength = 32;
        public const int MaxSurnameLength = 32;
        public const int MaxEmailAddressLength = 255;
        [Required]
        [MaxLength(MaxNameLength)]
        public virtual string Name { get; set; }
        [Required]
        [MaxLength(MaxSurnameLength)]
        public virtual string Surname { get; set; }
        [MaxLength(MaxEmailAddressLength)]
        public virtual string EmailAddress { get; set; }
    }

The Interface 

    public interface ISubjectAppService : IApplicationService
    {
        ListResultDto<SubjectsListDto> GetSubjects(GetSubjectsInput input);

    }

The App service

    public class SubjectAppService : EspertisAppServiceBase, ISubjectAppService
    {
        private readonly IRepository<Subject> _subjectRepository;
        public SubjectAppService(IRepository<Subject> subjectRepository)
        {
            _subjectRepository = subjectRepository;
        }

        public ListResultDto<SubjectsListDto> GetSubjects(GetSubjectsInput input)
        {
            var subjects = _subjectRepository
                .GetAll()
                .WhereIf(
                    !input.Filter.IsNullOrWhiteSpace(),
                    p => p.Name.Contains(input.Filter) ||
                         p.Surname.Contains(input.Filter) ||
                         p.EmailAddress.Contains(input.Filter)
                )
                .OrderBy(p => p.Name)
                .ThenBy(p => p.Surname)
                .ToList();

            return new ListResultDto<SubjectsListDto>(subjects.MapTo<List<SubjectsListDto>>());
        }
    }

and the test

    public class SubjectAppService_Tests : AppTestBase
    {
        private readonly ISubjectAppService _subjectAppService;

        public SubjectAppService_Tests()
        {
            _subjectAppService = Resolve<ISubjectAppService>();
        }

        [Fact]
        public void Should_Get_All_Subjects_Without_Any_Filter()
        {
            //Act
            var subjects = _subjectAppService.GetSubjects(new GetSubjectsInput());
            //Assert
            subjects.Items.Count.ShouldBe(2);
        }
    }

In the table Subjects there are two records.

Any idea ?

Best regards,

Albert

Hi,

I think also this is the solution.

I will try.

Thanks Albert

Hello,

Is there a simple way to have a project using ASP.NET Zero MVC 5 version but using Angular4 ?

Thanks

Albert

Hello ismcagdas,

I will try with your proposal about the use of areas.

As you say the best should to be to manage that via roles. But the problem is the following :

  • a person may be subject and/or expert
  • a user is only or subject or expert
  • according to the username, the user is redirected to the subject web application or to the expert web application.
  • but we need to communicate to the person via his email

Another solution is to use one user login and use a different URL like : expert.espertis.eu or subject.espertis.eu in order to redirect to the right web application but we want to use the "tenant" identification via URL. Is it sill work with URL like tenant1.expert.espertis.eu or tenant1.subject.exspertis.eu ?

Or another solution could be to offer via menu, a way to go to the other application when the user has the two roles : subject and expert ?

Thanks for your help, Albert

Hello,

I need to develop a multi-tenant project. The project is divided in 3 applications, accessed according to the role used by the user : admin, expert or subject.

About that, my questions are :

the best architecture to manage the 3 applications : 1 VS WEB project and 3 areas OR 3 VS WEB project
how to manage the fact that one email address may be associated with one or two users in order to manage the fact that one person may be expert and subject ?

Thanks for your advices Albert Janssens

Showing 11 to 15 of 15 entries