示例#1
0
        [HttpPost("/catalogs/{catalogId}/records")] // 'Create' a new record
        public ActionResult Create(int catalogId, string albumName)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Catalog foundCatalog = Catalog.Find(catalogId);
            Record  newRecord    = new Record(albumName);

            foundCatalog.AddRecord(newRecord);
            List <Record> catalogRecords = foundCatalog.Records;

            model.Add("records", catalogRecords);
            model.Add("catalog", foundCatalog);
            return(View("Show", model));
        }