コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("OcId,Date,ElectricityBillMonthName,ElectricityBillAmount,WaterBillMonth,WaterBillAmount,ItBill,FunctionCost,ScienceFairCost,StudyTourCost,PoorFund,SchoolDev,SchoolMaintenance,ServicingCharge,AnyCostName,AnyCostFee")] OtherCostInfo otherCostInfo)
        {
            if (id != otherCostInfo.OcId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(otherCostInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OtherCostInfoExists(otherCostInfo.OcId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(otherCostInfo));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("OcId,Date,ElectricityBillMonthName,ElectricityBillAmount,WaterBillMonth,WaterBillAmount,ItBill,FunctionCost,ScienceFairCost,StudyTourCost,PoorFund,SchoolDev,SchoolMaintenance,ServicingCharge,AnyCostName,AnyCostFee")] OtherCostInfo otherCostInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(otherCostInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(otherCostInfo));
        }