public BloodSeparation Add(int PlasmaID, int RedCellId, int ThrombocytesId)
        {
            BloodSeparation p = new BloodSeparation()
            {
                PlasmaId       = PlasmaID,
                RedCellId      = RedCellId,
                ThrombocytesId = ThrombocytesId
            };

            Repository.Add(p);

            return(p);
        }
 public void Add(BloodSeparation b)
 {
     using (var context = new DatabaseContainer())
     {
         context.BloodSeparationSet.Add(b);
         try
         {
             context.SaveChanges();
         }
         catch (Exception)
         {
             throw new ArgumentException("There is already a BloodSeparation with that id");
         }
     }
 }
        public ActionResult DonationComplete(AddDonateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("AddDonation", model));
            }

            if (model.Plasma < 0 || model.RedCell < 0 || model.Thrombocytes < 0)
            {
                ModelState.AddModelError(String.Empty, "Quantity cannot be 0");
                return(View("AddDonation", model));
            }
            else if (model.Date < DateTime.Today)
            {
                ModelState.AddModelError(String.Empty, "Date cannot be before today");
                return(View("AddDonation", model));
            }
            else
            {
                DonationAppointment app = _donationAppointmentService.GetById(model.AppointmentId);
                _donationAppointmentService.Update(app.Id, app.AppointmentDate, app.RequestId, true, app.ProfileId,
                                                   app.TransfusionCenterId);
                Plasma       p = _plasmaService.Add(model.Date.AddMonths(2), null, model.Plasma);
                RedCell      r = _redCellService.Add(model.Date.AddDays(42), null, model.RedCell);
                Thrombocytes t = _thrombocytesService.Add(model.Date.AddDays(5), null, model.Thrombocytes);

                BloodSeparation b = _bloodSeparation.Add(p.Id, r.Id, t.Id);

                Donation d = _donationService.Add(app.RequestId, model.Plasma + model.RedCell + model.Thrombocytes, model.Date, false,
                                                  StatusEnum.Preparated, app.ProfileId, b.Id, model.BloodType);

                LabResult lb = _labResultService.Add(false, false, false, false, false, "None", d.Id);
            }


            return(View("AddDonation", model));
        }