コード例 #1
0
        public IActionResult AddAsset()
        {
            if (!ModelState.IsValid)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;

                return(PartialView("AddAsset"));
            }



            var model = new AddAssetModel
            {
                Author         = "",
                ISBN           = "",
                deweyIndex     = "",
                Title          = "",
                Year           = "",
                Cost           = 0,
                Status         = _assetsService.GetStatuses(),
                Location       = _assetsService.GetBranches(),
                NumberOfCopies = 0,
                ImgUrl         = ""
            };

            return(View(model));
        }
コード例 #2
0
        public IActionResult Add(string database, int assetTypeId)
        {
            IActionResult action()
            {
                Guid  databaseId = this.ParseGuid(database);
                Asset emptyAsset = this.Api.DataBase.GenerateEmptyAsset(databaseId, assetTypeId);

                // TODO: Should we make this one query instead of 2?
                IAssetType    assetType  = this.Api.DataBase.GetAssetType(databaseId, assetTypeId);
                AddAssetModel assetModel = new AddAssetModel(this.Api, emptyAsset, assetTypeId, assetType);

                return(View(assetModel));
            };

            return(this.SafePerformAction(action));
        }