예제 #1
0
        public override ActionResponseDTO Validate()
        {
            ActionResponseWrapper actionResponse = new ActionResponseWrapper(EntityName);

            if (string.IsNullOrEmpty(Name))
            {
                actionResponse.AddError("'Nome' é campo obrigatório para um Escritor.");
            }

            return(actionResponse.Value);
        }
예제 #2
0
        public ActionResponseDTO List()
        {
            ActionResponseWrapper actionResponseWrapper = new ActionResponseWrapper(typeof(WriterApp).FullName);

            //Gets the list in the database
            IList <Writer> writerList = writerInfrastructure.List();

            //Translates
            IList <WriterDTO> writerListDTO = WriterTranslator.SetDTO(writerList);

            //Prepares the return
            actionResponseWrapper.SetContent(writerListDTO);

            return(actionResponseWrapper.Value);
        }
예제 #3
0
        public async Task <ActionResponseDTO> GetList()
        {
            ActionResponseWrapper actionResponseWrapper = new ActionResponseWrapper(typeof(ChallengeApp).FullName);

            //Gets the challenges in the database
            IList <Challenge> foundChallenges = await challengeInfrastructure.GetList();

            //Translates
            IList <ChallengeDTO> challengesDTO = ChallengeTranslator.SetDTO(foundChallenges);

            //Prepares the return
            actionResponseWrapper.SetContent(challengesDTO);

            return(actionResponseWrapper.Value);
        }
예제 #4
0
        public async Task <ActionResponseDTO> GetById(int id)
        {
            ActionResponseWrapper actionResponseWrapper = new ActionResponseWrapper(typeof(ChallengeApp).FullName);

            //Gets the challenge in the database
            Challenge foundChallenge = await challengeInfrastructure.GetById(id);

            //Translates
            ChallengeDTO challengeDTO = ChallengeTranslator.SetDTO(foundChallenge);

            //Prepares the return
            actionResponseWrapper.SetContent(challengeDTO);

            return(actionResponseWrapper.Value);
        }
예제 #5
0
        public override ActionResponseDTO Validate()
        {
            ActionResponseWrapper actionResponse = new ActionResponseWrapper(EntityName);

            if (string.IsNullOrWhiteSpace(Theme))
            {
                actionResponse.AddError("'Tema' é campo obrigatório de um desafio.");
            }

            if (AnnouncementDate == null || AnnouncementDate == DateTime.MinValue)
            {
                actionResponse.AddError("'Data de Anúncio' é campo obrigatório de um desafio.");
            }

            return(actionResponse.Value);
        }
예제 #6
0
        public override ActionResponseDTO Validate()
        {
            ActionResponseWrapper actionResponse = new ActionResponseWrapper(EntityName);

            if (Position <= 0)
            {
                actionResponse.AddError("'Posição' é campo obrigatório de uma classificação.");
            }

            if (ShortStory == null)
            {
                actionResponse.AddError("Toda classificação tem que ter um Conto atrelado a ela.");
            }
            else
            {
                actionResponse.IncorporateActionResponse(ShortStory.Validate());
            }

            return(actionResponse.Value);
        }
예제 #7
0
        public override ActionResponseDTO Validate()
        {
            ActionResponseWrapper actionResponse = new ActionResponseWrapper(EntityName);

            if (string.IsNullOrEmpty(Title))
            {
                actionResponse.AddError("'Título' é campo obrigatório para um Conto.");
            }

            if (Writer == null)
            {
                actionResponse.AddError("'Autor' é campo obrigatório para um Conto.");
            }
            else
            {
                actionResponse.IncorporateActionResponse(Writer.Validate());
            }

            return(actionResponse.Value);
        }