Beispiel #1
0
 internal void AddStock()
 {
     try
     {
         Medicine medicine = _stockService.GetMedicine(MedicineId);
         _stockService.AddANewStock(new Stock
         {
             MedicineId  = medicine.Id,
             Quantity    = Quantity,
             TotalPrice  = Quantity * medicine.Price,
             Description = Description
         });
         Notification = new NotificationModel("Success!",
                                              "Stock added successfully.",
                                              Notificationtype.Success);
     }
     catch (InvalidOperationException iex)
     {
         Notification = new NotificationModel("Failed!",
                                              "Failed to add Stock, please provide valid medicine name.",
                                              Notificationtype.Fail);
     }
     catch (Exception ex)
     {
         Notification = new NotificationModel("Failed!",
                                              "Failed to add Stock, please try again.",
                                              Notificationtype.Fail);
     }
 }