Ejemplo n.º 1
0
        public JsonResult AddReservation(AddReservation addReservation)
        {
            if (this.ModelState.IsValid)
            {
                addReservation.ExecuteNonQuery();
                return(new JsonResult()
                {
                    Data = new { Result = "Success" }
                });
            }

            return(new JsonResult()
            {
                Data = new { Result = "Failed" }
            });
        }
Ejemplo n.º 2
0
        public ActionResult _AddReservation(AddReservation addReservation)
        {
            if (this.ModelState.IsValid)
            {
                addReservation.ExecuteNonQuery();
                return(Json(new { Result = "Success", Url = "" }));
            }

            Guid?petId = addReservation.PetList?.FirstOrDefault();

            this.ViewData["AjaxFormModel"] = new AjaxFormModel()
            {
                Action = $"/providers/reservation/_AddReservation?PetId={petId}&OwnerId={addReservation.OwnerId}", FormTitle = "New Reservation", SubmitLabel = "Next", HttpMethod = "POST", OnSuccess = "app.onAjaxFormSuccess"
            };

            this.ViewData["SubmitLabel"] = "Next";

            return(View("FormModel", addReservation));
        }