예제 #1
0
 public IActionResult SuggestEvent(SuggestEventViewModel viewmodel)
 {
     if (ModelState.IsValid)
     {
         Answer ans = Gateway.AddSuggestedEvent(viewmodel);
         if (ans.AnswerType == AnswerType.Error)
         {
             //TODO implement error shower
             // TODO Log..
             return(View(viewmodel));
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     else
     {
         var invalidProperty = ModelState.First(x => x.Value.ValidationState == ModelValidationState.Invalid);
         SetUserError("תקלה במידע שהתקבל", invalidProperty.Value.Errors.FirstOrDefault()?.ErrorMessage ?? "אנא נסו שוב");
         return(View(viewmodel));
     }
 }