コード例 #1
0
ファイル: NetGrosServiceTests.cs プロジェクト: martasp/pay
 public void CalculateTest()
 {
     float[] data       = { 282.1f, 335.3f, 760f, 761f };
     float[] dataResult = { 310.00f, 380.00f, 1000.00f, 1001.32f };
     for (int i = 0; i < data.Length; i++)
     {
         var Expected = dataResult[i];
         var Actual   = NetGrossCalculator.CalculateGross(data[i]);
         Assert.AreEqual(Expected, Actual);
     }
 }
コード例 #2
0
ファイル: EmployersController.cs プロジェクト: martasp/pay
        public async Task <IActionResult> Index(int id)
        {
            Pagination(id);
            var users = await _repository.GetAll(id).ToListAsync();// await _context.User.Skip(id * 15).Take(15).ToListAsync();

            var UsersView = users.Select(x => new UserViewModel
            {
                ID          = x.UserId,
                Name        = x.Name,
                Surname     = x.Surname,
                NetSalary   = x.Salary,
                GroosSalary = NetGrossCalculator.CalculateGross(x.Salary)
            }).ToList();

            return(View("Index", UsersView));
        }
コード例 #3
0
        // GET: Users/Details
        public async Task <IActionResult> Details()
        {
            var CurrentUserID = User.Identity.Name;
            var user          = await _context.User.SingleOrDefaultAsync(m => m.OwnerID == CurrentUserID);

            if (user == null)
            {
                return(NotFound());
            }
            var userViewModel = new UserViewModel
            {
                ID          = user.UserId,
                Name        = user.Name,
                Surname     = user.Surname,
                NetSalary   = user.Salary,
                GroosSalary = NetGrossCalculator.CalculateGross(user.Salary)
            };

            return(View(userViewModel));
        }