public IActionResult PostForm(IFormCollection formCollection, IFormFile[] upload)
 {
     if (ModelState.IsValid)
     {
         if (upload != null && upload.Length > 0)
         {
             bool redirect = false;
             foreach (var file in upload)
             {
                 if (!(Path.GetExtension(file.FileName) == ".jpg" || Path.GetExtension(file.FileName) == ".jpeg" || Path.GetExtension(file.FileName) == ".png" || Path.GetExtension(file.FileName) == ".doc" ||
                       Path.GetExtension(file.FileName) == ".pdf" ||
                       Path.GetExtension(file.FileName) == ".rtf" ||
                       Path.GetExtension(file.FileName) == ".docx"))
                 {
                     redirect = true;
                 }
             }
             if (redirect)
             {
                 Redirect(Request.Headers["Referer"].ToString() + "?message=Dosya uzantısı izin verilen uzantılardan olmalıdır.");
             }
         }
         var result = feedbackService.FeedbackPost(formCollection, Request.HttpContext.Connection.RemoteIpAddress.ToString(), tenant.AppTenantId, upload);
         if (result == false)
         {
             return(Redirect("/tr/form/" + formCollection["Slug"]));
         }
         TempData["Referer"] = Request.Headers["Referer"].ToString();
         return(RedirectToAction("Successful", new { id = formCollection["FormId"] }));
     }
     return(Redirect(Request.Headers["Referer"].ToString() + "?message=Gönderdiğiniz formda geçersiz alanlar var"));
 }
Example #2
0
 public IActionResult PostForm(IFormCollection formCollection)
 {
     feedbackService.FeedbackPost(formCollection, null);
     return(RedirectToAction("Successful"));
 }
Example #3
0
        public IActionResult Create(IFormCollection formCollection, IFormFile[] upload)
        {
            feedbackService.FeedbackPost(formCollection, Request.HttpContext.Connection.RemoteIpAddress.ToString(), tenant.AppTenantId, upload);

            return(RedirectToAction("Index"));
        }