public async Task Post()
        {
            IncomeTaxViewModel incomeTaxViewModel = GenerateTestModel();
            var response = await this.Client.PostAsync(URI, new StringContent(JsonConvert.SerializeObject(incomeTaxViewModel).ToString(), Encoding.UTF8, "application/json"));

            Assert.Equal(HttpStatusCode.Created, response.StatusCode);
        }
        public IncomeTaxViewModel GetEmptyData()
        {
            IncomeTaxViewModel Data = new IncomeTaxViewModel();

            Data.name        = "";
            Data.rate        = null;
            Data.code        = "";
            Data.description = "";
            return(Data);
        }
Пример #3
0
        public IActionResult EditIncomeTax(IncomeTaxViewModel model)
        {
            var taxModel = dbcontext.IncomeTax.FirstOrDefault(x => x.Id == model.Id);

            if (taxModel != null)
            {
                taxModel.Id            = model.Id;
                taxModel.TaxableAmount = model.TaxableAmount;
                taxModel.Rate          = model.Rate;

                dbcontext.SaveChanges();
                return(RedirectToAction("GetTaxTable", "Tax", new { isSuccess = true }));
            }
            return(View());
        }
        public void Should_Succes_Intantiate_IncomeTaxViewModel()
        {
            int    id   = 1;
            string nama = "name test";
            double rate = 1.1;

            IncomeTaxViewModel viewModel = new IncomeTaxViewModel();

            viewModel.Id   = id;
            viewModel.Name = nama;
            viewModel.Rate = rate;

            Assert.Equal(id, viewModel.Id);
            Assert.Equal(nama, viewModel.Name);
            Assert.Equal(rate, viewModel.Rate);
        }
Пример #5
0
        public IActionResult EditIncomeTax(int taxId)
        {
            var taxModel = dbcontext.IncomeTax.FirstOrDefault(x => x.Id == taxId);

            if (taxModel != null)
            {
                var taxViewModel = new IncomeTaxViewModel
                {
                    Id            = taxModel.Id,
                    TaxableAmount = taxModel.TaxableAmount,
                    Rate          = taxModel.Rate
                };
                return(View(taxViewModel));
            }
            return(View());
        }
Пример #6
0
        public IActionResult GetTaxTable(bool isSuccess = false)
        {
            var incomeTaxList     = dbcontext.IncomeTax.ToList();
            var incomeTaxViewList = new List <IncomeTaxViewModel>();

            foreach (var item in incomeTaxList)
            {
                var obj = new IncomeTaxViewModel
                {
                    Id            = item.Id,
                    TaxableAmount = item.TaxableAmount,
                    Rate          = item.Rate
                };
                incomeTaxViewList.Add(obj);
            }
            ViewBag.isSuccess = isSuccess;
            return(View(incomeTaxViewList));
        }
        public async Task <IActionResult> Index(IncomeTaxViewModel model)
        {
            string utin = "";
            string tin  = "";

            for (int i = 0; i < model.utin.Length; i++)
            {
                utin = utin + model.utin[i];
            }
            for (int j = 0; j < model.tin.Length; j++)
            {
                tin = tin + model.tin[j];
            }

            IncomeTax incomeTax = new IncomeTax
            {
                nameOfAsse        = model.nameOfAsse,
                nid               = model.nid,
                utin              = utin,
                tin               = tin,
                circel            = model.circel,
                taxZone           = model.taxZone,
                asseYear          = model.asseYear,
                isResident        = model.isResident,
                familyStatus      = model.familyStatus,
                nameOFEmployee    = model.nameOFEmployee,
                husbandORWife     = model.husbandORWife,
                father            = model.father,
                mother            = model.mother,
                dateOFBirth       = model.dateOFBirth,
                presentAddress    = model.presentAddress,
                prmanentAddress   = model.prmanentAddress,
                mobileOffice      = model.mobileOffice,
                residential       = model.residential,
                vatRegistrationNo = model.vatRegistrationNo
            };

            await _context.IncomeTaxes.AddAsync(incomeTax);

            await _context.SaveChangesAsync();

            return(Json(_context.IncomeTaxes.ToList()));
        }
        public IncomeTaxViewModel MapToViewModel(IncomeTax incomeTax)
        {
            IncomeTaxViewModel incomeTaxVM = new IncomeTaxViewModel();

            incomeTaxVM._id          = incomeTax.Id;
            incomeTaxVM._deleted     = incomeTax._IsDeleted;
            incomeTaxVM._active      = incomeTax.Active;
            incomeTaxVM._createdDate = incomeTax._CreatedUtc;
            incomeTaxVM._createdBy   = incomeTax._CreatedBy;
            incomeTaxVM._createAgent = incomeTax._CreatedAgent;
            incomeTaxVM._updatedDate = incomeTax._LastModifiedUtc;
            incomeTaxVM._updatedBy   = incomeTax._LastModifiedBy;
            incomeTaxVM._updateAgent = incomeTax._LastModifiedAgent;
            incomeTaxVM.name         = incomeTax.Name;
            incomeTaxVM.rate         = incomeTax.Rate;
            incomeTaxVM.description  = incomeTax.Description;

            return(incomeTaxVM);
        }
        public IncomeTax MapToModel(IncomeTaxViewModel incomeTaxVM)
        {
            IncomeTax incomeTax = new IncomeTax();

            incomeTax.Id                 = incomeTaxVM._id;
            incomeTax._IsDeleted         = incomeTaxVM._deleted;
            incomeTax.Active             = incomeTaxVM._active;
            incomeTax._CreatedUtc        = incomeTaxVM._createdDate;
            incomeTax._CreatedBy         = incomeTaxVM._createdBy;
            incomeTax._CreatedAgent      = incomeTaxVM._createAgent;
            incomeTax._LastModifiedUtc   = incomeTaxVM._updatedDate;
            incomeTax._LastModifiedBy    = incomeTaxVM._updatedBy;
            incomeTax._LastModifiedAgent = incomeTaxVM._updateAgent;
            incomeTax.Name               = incomeTaxVM.name;
            incomeTax.Rate               = !Equals(incomeTaxVM.rate, null) ? Convert.ToDouble(incomeTaxVM.rate) : null; /* Check Null */
            incomeTax.Description        = incomeTaxVM.description;

            return(incomeTax);
        }
Пример #10
0
        public IncomeTaxViewModel MapToViewModel(IncomeTax incomeTax)
        {
            IncomeTaxViewModel incomeTaxVM = new IncomeTaxViewModel
            {
                Id                 = incomeTax.Id,
                UId                = incomeTax.UId,
                _IsDeleted         = incomeTax._IsDeleted,
                Active             = incomeTax.Active,
                _CreatedUtc        = incomeTax._CreatedUtc,
                _CreatedBy         = incomeTax._CreatedBy,
                _CreatedAgent      = incomeTax._CreatedAgent,
                _LastModifiedUtc   = incomeTax._LastModifiedUtc,
                _LastModifiedBy    = incomeTax._LastModifiedBy,
                _LastModifiedAgent = incomeTax._LastModifiedAgent,
                name               = incomeTax.Name,
                rate               = incomeTax.Rate,
                description        = incomeTax.Description,
                COACodeCredit      = incomeTax.COACodeCredit
            };

            return(incomeTaxVM);
        }
Пример #11
0
        public IncomeTax MapToModel(IncomeTaxViewModel incomeTaxVM)
        {
            IncomeTax incomeTax = new IncomeTax
            {
                Id                 = incomeTaxVM.Id,
                UId                = incomeTaxVM.UId,
                _IsDeleted         = incomeTaxVM._IsDeleted,
                Active             = incomeTaxVM.Active,
                _CreatedUtc        = incomeTaxVM._CreatedUtc,
                _CreatedBy         = incomeTaxVM._CreatedBy,
                _CreatedAgent      = incomeTaxVM._CreatedAgent,
                _LastModifiedUtc   = incomeTaxVM._LastModifiedUtc,
                _LastModifiedBy    = incomeTaxVM._LastModifiedBy,
                _LastModifiedAgent = incomeTaxVM._LastModifiedAgent,
                Name               = incomeTaxVM.name,
                Rate               = !Equals(incomeTaxVM.rate, null) ? Convert.ToDouble(incomeTaxVM.rate) : null,
                Description        = incomeTaxVM.description,
                COACodeCredit      = incomeTaxVM.COACodeCredit
            };

            return(incomeTax);
        }
Пример #12
0
        public IncomeTaxViewModel GetEmptyData()
        {
            IncomeTaxViewModel Data = new IncomeTaxViewModel();

            return(Data);
        }