Exemple #1
0
        public async Task AddDocente(Usuario user, DocenteViewModel docenteViewModel)
        {
            docenteViewModel.userId = user.Id;

            if (createDocenteEntityBusinessRules.CanCreate(docenteViewModel))
            {
                var docente = Mapper.Map <Docente>(docenteViewModel);
                docente.Id = Guid.NewGuid().ToString();
                await docentesRepository.CreateDocente(user.Id, docente);
            }

            else
            {
                throw new InvalidOperationException(DocenteErrorMessages.DocenteAlreadyExists);
            }
        }