public ActionResult Create()
        {
            var usersList = GetAvailableUsersList();
            var usersToShow = GenerateUsersToShowList(usersList);
            var companiesList = _companiesManagement.GetCompaniesList();
            var now = DateTime.Now;
            var editViewModel = new EditViewModel
                {
                    TransactionId = 0,
                    Amount = 0.0,
                    Points = 50,
                    BillBarCode = "",
                    Company = new Company(),
                    CompaniesList = companiesList,
                    Customer = new User(),
                    //CustomersList = usersList,
                    TransactionDate = now.Day + "/" + now.Month + "/" + now.Year,
                    Comision = 0.0,
                    UsersToShowList = usersToShow
                    //SalesMan = new User(),
                    //ListSalesMan = usersList,
                };

            return View("Edit", editViewModel);
        }
        public ActionResult Edit(int id)
        {
            var transaction = _transactionsManagement.GetTransaction(id);
            var usersList = GetAvailableUsersList();
            var usersToShow = GenerateUsersToShowList(usersList);
            var editViewModel = new EditViewModel
                {
                    TransactionId = id,
                    Amount = transaction.Amount,
                    BillBarCode = transaction.BillBarCode,
                    Company = transaction.Company,
                    CompaniesList = _companiesManagement.GetCompaniesList(),
                    Customer = transaction.User,
                    //CustomersList = GetAvailableUsersList(),
                    Points = transaction.Points,
                    TransactionDate = transaction.TransactionDate.ToString("dd/MM/yyyy"),
                    Comision = transaction.Comision,
                    UsersToShowList = usersToShow
                };

            return View("Edit", editViewModel);
        }
        public ActionResult Save(EditViewModel editFormModel)
        {
            if (ModelState.IsValid)
            {
                Transaction transaction;
                var company = _companiesManagement.GetCompany(editFormModel.Company.CompanyId);
                var comision = editFormModel.Comision < 0.0000001
                                   ? editFormModel.Amount*company.CashBackPercentaje/100
                                   : editFormModel.Comision;
                if (editFormModel.TransactionId == 0)
                {

                    transaction = new Transaction
                        {
                            TransactionId = 0,
                            Amount = editFormModel.Amount,
                            BillBarCode = editFormModel.BillBarCode,
                            CreatetedAt = DateTime.Now,
                            UpdatedAt = DateTime.Now,
                            TransactionDate = Convert.ToDateTime(editFormModel.TransactionDate),
                            UserId = editFormModel.Customer.UserId,
                            Points = editFormModel.Points,
                            CompanyId = editFormModel.Company.CompanyId,
                            Comision = comision,
                        };
                    _transactionsManagement.SaveTransaction(transaction);
                    return RedirectToAction("Index");
                }

                transaction = _transactionsManagement.GetTransaction(editFormModel.TransactionId);
                transaction.BillBarCode = editFormModel.BillBarCode;
                transaction.Amount = editFormModel.Amount;
                transaction.UserId = editFormModel.Customer.UserId;
                transaction.Points = editFormModel.Points;
                transaction.CompanyId = editFormModel.Company.CompanyId;
                transaction.TransactionDate = Convert.ToDateTime(editFormModel.TransactionDate);
                transaction.UpdatedAt = DateTime.Now;
                transaction.Comision = comision;
                _transactionsManagement.UpdateTransaction();
                return RedirectToAction("Index");
            }

            //editViewModel.CustomersList = GetAvailableUsersList();
            var usersList = GetAvailableUsersList();
            var usersToShow = GenerateUsersToShowList(usersList);
            editFormModel.CompaniesList = _companiesManagement.GetCompaniesList();
            editFormModel.UsersToShowList = usersToShow;
            return View("Edit", editFormModel);
        }