Exemplo n.º 1
0
        public async Task <string> CretaePoll(PostPollRequest request)
        {
            if (request == null)
            {
                throw new Exception(nameof(request));
            }
            if (request.Form == null)
            {
                throw new Exception(nameof(request.Form));
            }

            string validationMessage;

            if (ValidNewPollData(request.Form, out validationMessage))
            {
                var newPoll = BuildNewPoll(request.Form);
                _dynamicFormDataContext.Polls.Add(newPoll);

                await _dynamicFormDataContext.SaveChangesAsync();
            }

            return(validationMessage);
        }
Exemplo n.º 2
0
 public async Task <string> CreateForm([FromBody] PostPollRequest request)
 {
     return(await _pollsAppService.CretaePoll(request));
 }