public static CountryAllowance MapToModel(this CountryAllowanceVM view)
        {
            if (view == null)
            {
                return(null);
            }

            return(new CountryAllowance
            {
                Id = view.Id,
                Country = view.Country,
                Amount = view.Amount,
                AllowanceCurrency = view.AllowanceCurrency,
                OfficialCurrency = view.OfficialCurrency
            });
        }
        public ActionResult Save(CountryAllowanceVM view)
        {
            ModelState.Remove("Id");
            if (ModelState.IsValid)
            {
                if (view.Id == 0)
                {
                    _countryAllowanceRepository.AddToDatabase(view.MapToModel());
                }
                else
                {
                    _countryAllowanceRepository.UpdateInDatabase(view.MapToModel(), view.Id);
                }

                _countryAllowanceRepository.Save();
            }
            return(RedirectToAction("Index"));
        }