コード例 #1
0
        public ActionResult Create(Persons clients)
        {
            int status = clientsB.Create(clients);

            if (status == 200)
            {
                TempData["message"] = "Add";
                return(Json(new { success = true }));
            }
            else if (status == 400)
            {
                ModelState.AddModelError("Code", "El codigo se está usando actualmente");
                return(View(clients));
            }
            return(View(clients));
        }
コード例 #2
0
        public IHttpActionResult Post(Persons persons)
        {
            int clients;

            ClientsB clientB = new ClientsB();

            clients = clientB.Create(persons);

            switch (clients)
            {
            case 200:
                return(Ok(200));

            case 400:
                return(Ok(400));

            case 500:
                return(Ok(500));

            default:
                return(Ok(false));
            }
        }