Пример #1
0
        public ActionResult Save(FormCollection collection)
        {
            TempData["id"] = TempData["id"];
            AppointmentId  = (int)TempData["id"];
            var           check     = collection["test"].Split(',');
            List <string> checkList = check.ToList();
            List <int>    quant     = collection["quantity"].Split(',').Select(int.Parse).ToList();
            List <int>    Ids       = collection["medicineId"].Split(',').Select(int.Parse).ToList();

            float sum = 0;

            for (int i = 0; i < Ids.Count; i++)
            {
                medicine = new MedicinesQuantity();
                if (quant[i] != 0)
                {
                    int MedicineID = Ids[i];
                    medicine.Medicine_Id    = MedicineID;
                    medicine.MedicineRate   = patientBusinessLayer.GetMedicineCost(MedicineID);
                    medicine.Appointment_Id = AppointmentId;
                    medicine.quantity       = quant[i];
                    sum = sum + medicine.MedicineRate * quant[i];

                    medicinelist.Add(medicine);
                }
            }
            int fees = patientBusinessLayer.GetDoctorFeesByAppointmentId(AppointmentId);

            Total             = Convert.ToInt32(sum + fees);
            ViewData["fees"]  = fees;
            TempData["total"] = sum + fees;
            CreateInvoice();
            patientBusinessLayer.SaveData(medicinelist);
            return(RedirectToAction("InvoiceList", "Invoice", new { AppointmentId = AppointmentId }));
        }