public void SaveMedicalAllowance(MedicalAllowanceInfo medicalAllowanceInfo)
        {
            Data.MedicalAllowance medicalAllowance = ConvertToDb(medicalAllowanceInfo);

            _context.MedicalAllowances.Add(medicalAllowance);
            _context.SaveChanges();
        }
 public MedicalAllowanceInfo ConvertToFacade(Data.MedicalAllowance medicalAllowance)
 {
     return(new MedicalAllowanceInfo
     {
         Id = medicalAllowance.Id,
         Category = medicalAllowance.Category,
         Amount = medicalAllowance.Amount
     });
 }
        public void DeleteMedicalAllowance(int id)
        {
            Data.MedicalAllowance medicalAllowance = _context.MedicalAllowances.Find(id);

            if (medicalAllowance != null)
            {
                _context.MedicalAllowances.Remove(medicalAllowance);
                _context.SaveChanges();
            }
            else
            {
                throw new ArgumentNullException();
            }
        }
        public void UpdateMedicalAllowance(MedicalAllowanceInfo medicalAllowanceInfo)
        {
            Data.MedicalAllowance medicalAllowance = _context.MedicalAllowances.Find(medicalAllowanceInfo.Id);

            if (medicalAllowance != null)
            {
                medicalAllowance.Category = medicalAllowanceInfo.Category;
                medicalAllowance.Amount   = medicalAllowanceInfo.Amount;

                _context.SaveChanges();
            }
            else
            {
                throw new ArgumentNullException();
            }
        }