Пример #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"));
        }