Exemplo n.º 1
0
        public IActionResult Edit(int id)
        {
            var angajat = _serviciiAngajati.GetById(id);

            if (angajat == null)
            {
                return(NotFound());
            }

            var model = new AngajatEditViewModel()
            {
                Id             = angajat.Id,
                NrAngajat      = angajat.NrAngajat,
                NumeAngajat    = angajat.NumeAngajat,
                PrenumeAngajat = angajat.PrenumeAngajat,
                Sex            = angajat.Sex,
                Email          = angajat.Email,
                ZiNastere      = angajat.ZiNastere,
                ZiAngajare     = angajat.ZiAngajare,
                MetodaPlata    = angajat.MetodaPlata,
                Adresa         = angajat.Adresa,
                Oras           = angajat.Oras,
                NrTelefon      = angajat.NrTelefon,
                Functie        = angajat.Functie,
            };

            return(View(model));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create(IstoricPlataCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var istoricplata = new IstoricPlata()
                {
                    Id                 = model.Id,
                    IdAngajat          = model.IdAngajat,
                    Nume               = _serviciiAngajati.GetById(model.IdAngajat).Nume,
                    ZiPlata            = model.ZiPlata,
                    LunaPlata          = model.LunaPlata,
                    IdAnTaxa           = model.IdAnTaxa,
                    RataOra            = model.RataOra,
                    OreLucrate         = model.OreLucrate,
                    OreContract        = model.OreContract,
                    OreExtra           = oreExtra = _serviciiPlata.OreExtra(model.OreLucrate, model.OreContract),
                    SalariuContractual = salariuContract = _serviciiPlata.SalariuContractual(model.OreContract, model.OreLucrate, model.RataOra),
                    PlataExtra         = plataExtra = _serviciiPlata.PlataExtra(_serviciiPlata.RataOraExtra(model.RataOra), oreExtra),
                    CastiguriTotale    = castiguriTotale = _serviciiPlata.CastiguriTotale(plataExtra, salariuContract),
                    TaxeSalariale      = taxeSalariale = _serviciiPlata.TaxeSalariale(salariuContract),
                    TaxeTotale         = taxeTotale = _serviciiPlata.TaxeTotale(castiguriTotale),
                    PlataNeta          = _serviciiPlata.CastigNet(castiguriTotale, taxeTotale)
                };
                await _serviciiPlata.CreateAsync(istoricplata);

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.angajati = _serviciiAngajati.GetAllAngajatiForPlata();
            ViewBag.aniTaxa  = _serviciiPlata.GetAllAnTaxa();
            return(View());
        }