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)); }
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)); }