예제 #1
0
        // GET: Custody
        public ActionResult NewCustodyType()
        {
            var custodyTypes  = HttpHelper.GetList <string>("api/custodytypes");
            var custodyTypeVm = new CustodyTypeViewModel()
            {
                custodyTypeList = custodyTypes.Result.ToList()
            };

            return(View(custodyTypeVm));
        }
예제 #2
0
        public ActionResult PostCustodyType(CustodyTypeViewModel custodyTypeVm)
        {
            if (!ModelState.IsValid)
            {
                return(View("NewCustodyType", custodyTypeVm));
            }
            var custodyEntry  = new { custodyType1 = custodyTypeVm.custodyType1 };
            var custodyAsJson = JsonConvert.SerializeObject(custodyEntry);
            var response      = HttpHelper.Post(custodyAsJson, "api/custodytypes");

            Thread.Sleep(1000);

            return(RedirectToAction("NewCustodyType", "Custody"));
        }