public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         //it will chose thanks page in View(MVC) and send object info.
         return(View("Thanks", guestResponse));
     }
     else
     {
         return(View());
     }
 }
示例#2
0
 public ViewResult RsvpForm(CompetitionInvite competitionInvite)
 {
     if (ModelState.IsValid)
     {
         Repository.AddResponse(competitionInvite);
         return(View("Thanks", competitionInvite));
     }
     else
     {
         // there is a validation error
         return(View());
     }
 }
示例#3
0
 public IActionResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         //Error
         return(View());
     }
 }
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         //there is a validation error
         return(View());
     }
 }
示例#5
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)             // sprawdzanie poprawności danych zwraca true lub false
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         // Błąd kontroli poprawności danych
         return(View());
     }
 }
示例#6
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         // ВИЗУАЛИЗАЦИЯ  представления "Thanks" и передать ему обьект модели GuestResponse
         return(View("Thanks", guestResponse));
     }
     else
     {
         return(View());
     }
 }
示例#7
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     //The Controller base class provides a property called ModelState that provides details of the outcome of the model binding process.If the ModelState.IsValid property returns true, then I know that the model binder has been able to satisfy the validation constraints I specified through the attributes on the GuestResponse class. When this happens, I render the Thanks view, just as I did previously. If the ModelState.IsValid property returns false, then I know that there are validation errors. The object returned by the ModelState property provides details of each problem that has been encountered, but I don’t need to get into that level of detail because I can rely on a useful feature that automates the process of asking the user to address any problems by calling the View method without any parameters.
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         return(View());
     }
 }
示例#8
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid) //checks to see if the validation constraints have been satisfied
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         // there is a validation error
         return(View());
     }
 }
示例#9
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)
     {
         guestResponse.RsvpTime = DateTime.Now;
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         return(View());
     }
 }
示例#10
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         // Обноружена ошибка проверки достоверности.
         return(View());
     }
 }
 [HttpPost]// method sau day chi su ly POST request.
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid) //ModelState do base controler cung cap
                             //chua thong tin chi tiet va ket qua ve qua trinh rang buoc cua Model
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         return(View());
     }
 }
示例#12
0
 public ViewResult RsvpForm(GuestResponse guestResponce)
 {
     // TODO: Store responce from guest
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponce);
         return(View("Thanks", guestResponce));
     }
     else
     {
         return(View());
     }
 }
示例#13
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     //Stores Guest Response using HTTP POST if it is valid
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         return(View());
     }
 }
示例#14
0
        public IActionResult Register(GuestResponse response)
        {
            if (ModelState.IsValid)
            {
                Repository.AddResponse(response);

                return(View("ThankYou", response));
            }
            else
            {
                return(View());
            }
        }
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         // isValid == false
         return(View());
     }
 }
示例#16
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         Console.WriteLine("Model non valide");
         return(View());
     }
 }
示例#17
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)
     {
         int created = CreateGuest(guestResponse.Nickname, guestResponse.Fancymail,
                                   guestResponse.FavouriteAnimal, guestResponse.WillAttend);
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         return(View());
     }
 }
示例#18
0
        public ViewResult RsvpForm(GuestResponse guestResponse)
        {
            // add post data to list
            if (ModelState.IsValid)
            {
                Repository.AddResponse(guestResponse);

                return(View("Thanks", guestResponse));
            }
            else
            {
                return(View());
            }
        }
示例#19
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         //Открыть представление Thanks и передать туда параметр guestResponse
         return(View("Thanks", guestResponse));
     }
     else
     {
         // тут ошибка в результате проверки
         return(View());
     }
 }
示例#20
0
        public ViewResult RsvpForm(GuestResponse guestResponse)
        {
            string por = null;

            if (ModelState.IsValid)
            {
                Repository.AddResponse(guestResponse);
                return(View("Thanks", guestResponse));
            }
            else
            {
                return(View());
            }
        }
示例#21
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     //ToDo: store response from Guest
     if (ModelState.IsValid)  // Passes all constraints
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         //A validation error occurred
         return(View());
     }
 }
示例#22
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         // Что сделать: сохранить ответ гостя
         return(View("Thanks", guestResponse));
     }
     else
     {
         // обнаружена ошибка проверки достоверности.
         return(View());
     }
 }
示例#23
0
        public IActionResult RsvpForm(GuestResponse gr)
        {
            if (ModelState.IsValid)
            {
                Repository.AddResponse(gr); // add response to the list

                return(View("Thanks", gr)); // display the thanks  view
            }

            else
            {
                return(View());
            }
        }
示例#24
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     // TODO: store resonse from guest
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         //There's a validation error
         return(View());
     }
 }
示例#25
0
 //Created post method for containing response and return view with thanks
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     //Data validation
     if (ModelState.IsValid)
     {
         Repository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         //Error in correctness control
         return(View());
     }
 }
示例#26
0
 public ViewResult RsvpForm(GuestResponse response)
 {
     // Description: Handles the form by stroing the information
     // ModelState is the property of the base class (Controller) which specifies whether the data passed from form was valid or not. If ModelState.IsValid is false, something wrong has happened according to validation attributes that had been defined in the model. Otherwise, the boolean is going to be true
     if (ModelState.IsValid)
     {
         Repository.AddResponse(response);
         // View( x , y ) means that the action is going to be returned to x view with the object of the model (y) that has been instanced before. The idea is to obtain the data that has been saved to the model earlier.
         return(View("Thanks", response));
     }
     else
     {
         return(View());
     }
 }
示例#27
0
        public ViewResult RsvpForm(GuestResponse guestResponse)
        {
            //TODO: store response from guest

            //Checks to see if there is a validation error:
            if (ModelState.IsValid)
            {
                Repository.AddResponse(guestResponse);
                return(View("Thanks", guestResponse));
            }
            else
            {
                return(View());
            }
        }
示例#28
0
        public IActionResult RsvpForm(GuestResponse gr)
        {
            if (ModelState.IsValid)
            {
                Repository.AddResponse(gr);

                return(View("Thanks", gr));
            }
            else
            {
                return(View());
            }
            Repository.AddResponse(gr);

            return(View("Thanks", gr));// look for Thanks.csthml
        }
示例#29
0
        public ViewResult RsvpForm(GuestResponse guestResponse)
        {
            //Estou fazendo essa verificação, pois os meus campos são obrigatórios.
            if (ModelState.IsValid)
            {
                Repository.AddResponse(guestResponse);

                //No retorno abaixo, está sendo chamada uma pagina Thanks e esta sendo populado nela o objeto guestResponse
                return(View("Thanks", guestResponse));
            }
            else
            {
                //Isso é um errro de validação
                return(View());
            }
        }
        public ViewResult RsvpForm(GuestResponse guestResponse)
        {
            //TODO: wysyłanie maila do organizatora

            //walidacja formularza
            if (ModelState.IsValid)
            {
                //adding response to Repository
                Repository.AddResponse(guestResponse);
                return(View("Thanks", guestResponse));
            }
            else
            {
                //niepoprawne dane
                return(View());
            }
        }