Exemplo n.º 1
0
        public HttpResponseMessage SubmitForm(List <SubmitFormFieldModel> formFields)
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);

            FormsBLL.SubmitExternalForm(SubmitFormFieldModel.MapModelToExternalFormSubmitValues(formFields));
            return(response);
        }
Exemplo n.º 2
0
        public HttpResponseMessage GetForm(string clubShortName, string formName)
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
            FormModel           form     = FormModel.MapFormModel(FormsBLL.GetForm(clubShortName, formName), true);

            response.Content = new ObjectContent <FormModel>(form, new JsonMediaTypeFormatter());
            return(response);
        }
Exemplo n.º 3
0
        public HttpResponseMessage SubmitForm(List <SubmitFormFieldModel> formFields)
        {
            HttpResponseMessage response     = new HttpResponseMessage(HttpStatusCode.OK);
            UserPrincipal       loggedInUser = (UserPrincipal)HttpContext.Current.User;

            FormsBLL.SubmitForm(SubmitFormFieldModel.MapModelToFormSubmitValues(formFields,
                                                                                loggedInUser.AccountSession.AccountId, loggedInUser.AccountSession.ClubId));
            return(response);
        }
Exemplo n.º 4
0
        public HttpResponseMessage GetForm(int formId)
        {
            HttpResponseMessage response     = new HttpResponseMessage(HttpStatusCode.OK);
            UserPrincipal       loggedInUser = (UserPrincipal)HttpContext.Current.User;
            FormModel           form         = FormModel.MapFormModel(FormsBLL.GetForm(loggedInUser.AccountSession.ClubId, formId), true);

            response.Content = new ObjectContent <FormModel>(form, new JsonMediaTypeFormatter());
            return(response);
        }
Exemplo n.º 5
0
        public HttpResponseMessage GetUnansweredForms(int count)
        {
            HttpResponseMessage response     = new HttpResponseMessage(HttpStatusCode.OK);
            UserPrincipal       loggedInUser = (UserPrincipal)HttpContext.Current.User;
            List <FormModel>    forms        = FormModel.MapFormModels(FormsBLL.GetUnansweredForms(loggedInUser.AccountSession.ClubId,
                                                                                                   loggedInUser.AccountSession.AccountId, count));

            response.Content = new ObjectContent <List <FormModel> >(forms, new JsonMediaTypeFormatter());
            return(response);
        }
Exemplo n.º 6
0
        public async Task <HttpResponseMessage> ImportExcelFile()
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);

            if (!Request.Content.IsMimeMultipartContent())
            {
                response.StatusCode = HttpStatusCode.UnsupportedMediaType;
            }
            else
            {
                MultipartMemoryStreamProvider provider = new MultipartMemoryStreamProvider();
                await Request.Content.ReadAsMultipartAsync(provider);

                Task <byte[]> fileData = provider.Contents.First().ReadAsByteArrayAsync();
                int           formId   = int.Parse(((System.Web.HttpContextWrapper)Request.Properties["MS_HttpContext"]).Request.Form["formId"]);

                FormExcelImportResult result = FormsBLL.SubmitExternalFormFromExcel(fileData.Result, formId);

                response.Content = new ObjectContent <FormExcelImportResult>(result, new JsonMediaTypeFormatter());
            }

            return(response);
        }