public ActionResult Add()
        {
            var viewModel = new AddExchangeRateViewModel();

            if (!this.IsMegaAdmin())
            {
                viewModel.SeletedOrganisationId = this.userService.GetUserOrganisationId(this.User.Identity.GetUserId());
            }
            else
            {
                viewModel.Organisations = this.organisationService.GetAll().ToList()
                                          .ConvertAll(x => new OrganisationViewModel
                {
                    Id   = x.Id,
                    Name = x.Name
                });
            }
            return(View(viewModel));
        }
        public ActionResult Add(AddExchangeRateViewModel model)
        {
            if ((!ModelState.IsValid) || model.To == 0 || model.From == 0)
            {
                if (model.To == 0)
                {
                    this.ModelState.AddModelError("To", ExchangeRateTr.ToCurrencyIsRequired);
                }

                if (model.From == 0)
                {
                    this.ModelState.AddModelError("From", ExchangeRateTr.FromCurrencyIsRequired);
                }

                if (!this.IsMegaAdmin())
                {
                    model.SeletedOrganisationId = this.userService.GetUserOrganisationId(this.User.Identity.GetUserId());
                }
                else
                {
                    model.Organisations = this.organisationService.GetAll().ToList()
                                          .ConvertAll(x => new OrganisationViewModel
                    {
                        Id   = x.Id,
                        Name = x.Name
                    });
                }
                return(View(model));
            }

            var userORg = this.userService.GetUserOrganisationId(this.User.Identity.GetUserId());

            if (this.IsMegaAdmin())
            {
                userORg = model.SeletedOrganisationId;
            }
            //Check is there a exchange rate for the currenciess
            if (this.exchangeService.Exist(model.From, model.To, userORg))
            {
                this.ModelState.AddModelError("", ExchangeRateTr.Exist);
                if (!this.IsMegaAdmin())
                {
                    model.SeletedOrganisationId = this.userService.GetUserOrganisationId(this.User.Identity.GetUserId());
                }
                else
                {
                    model.Organisations = this.organisationService.GetAll().ToList()
                                          .ConvertAll(x => new OrganisationViewModel
                    {
                        Id   = x.Id,
                        Name = x.Name
                    });
                }
                return(View(model));
            }

            //Add a new exchange rate
            this.exchangeService.Add(new ExchangeRate
            {
                ExchangeRateValue = model.Rate,
                FromId            = model.From,
                ToId           = model.To,
                OrganisationId = model.SeletedOrganisationId
            });

            return(Redirect("/HelpModule/ExchangeRate/Index"));
        }