コード例 #1
0
        public async Task <IActionResult> EditCost(int costId, int unitId, string name, int price, CostType costType, DateTime date)
        {
            if (!await CanUserVisitPage(unitId))
            {
                return(RedirectToAction("AccessError", "Home"));
            }

            var costWithCostTypesDTO = new CostWithCostTypesDTO
            {
                CostDTO   = GetCostDTO(unitId, name, price, costType, date, costId),
                CostTypes = GetCostTypes()
            };

            return(View(costWithCostTypesDTO));
        }
コード例 #2
0
        public async Task <IActionResult> CreateCost(int unitId)
        {
            if (!await CanUserVisitPage(unitId))
            {
                return(RedirectToAction("AccessError", "Home"));
            }

            var costDTO = new CostDTO
            {
                UnitId = unitId,
                Date   = DateTime.Today
            };

            var costWithCostTypesDTO = new CostWithCostTypesDTO
            {
                CostDTO   = costDTO,
                CostTypes = GetCostTypes(),
            };

            return(View(costWithCostTypesDTO));
        }