Пример #1
0
        public async Task <IActionResult> Create(CreateBillDTO model)
        {
            if (ModelState.IsValid)
            {
                if (model.Apartment == "all")
                {
                    await billService.BillAllApartments(model.Text, Decimal.Parse(model.Amount));

                    return(Redirect("/Bills/All"));
                }
                else
                {
                    await billService.BillOneApartment(model.Apartment, model.Text, Decimal.Parse(model.Amount));

                    return(Redirect("/Bills/All"));
                }
            }
            List <ApartmentListElementDTO> list = new List <ApartmentListElementDTO>();

            list.Add(new ApartmentListElementDTO {
                Id = "all", Number = "all"
            });
            list.AddRange(apartmentServise.GetAppartments().OrderBy(x => x.Number));
            ViewBag.apartmantList = list;
            return(View(model));
        }