コード例 #1
0
        public ActionResult Uredi(int?Id)
        {
            Klinika DBKlinika = ctx.Klinikas.Include(x => x.Opstina).
                                Where(x => x.Id == Id).FirstOrDefault();

            KlinikaUrediVM Model = new KlinikaUrediVM
            {
                Id            = DBKlinika.Id,
                Sifra         = DBKlinika.Sifra,
                Naziv         = DBKlinika.Naziv,
                OpstinaId     = DBKlinika.OpstinaId,
                Vrsta         = DBKlinika.Vrsta,
                Adresa        = DBKlinika.Adresa,
                IdBroj        = DBKlinika.IdBroj,
                PDVbroj       = DBKlinika.PDVbroj,
                ZdravInstitBr = DBKlinika.ZdravInstitBr,
                KoefRPV       = DBKlinika.KoefRPV,
                KoefPR        = DBKlinika.KoefPR,
                KoefGO        = DBKlinika.KoefGO,
                KoefBD42D     = DBKlinika.KoefBD42D,
                KoefBP42D     = DBKlinika.KoefBP42D,
                KoefRN        = DBKlinika.KoefRN,
                KoefNS        = DBKlinika.KoefNS,
                KoefNR        = DBKlinika.KoefNR,
                KoefRDP       = DBKlinika.KoefRDP,
                Valid         = DBKlinika.Valid
            };

            Model.OpstineList = UcitajOpstine();



            return(View("Uredi", Model));
        }
コード例 #2
0
        public ActionResult Dodaj()
        {
            KlinikaUrediVM Model = new KlinikaUrediVM();

            List <SelectListItem> Opstine = UcitajOpstine();

            Model.OpstineList = Opstine;
            Model.Valid       = true;

            return(View("Uredi", Model));
        }
コード例 #3
0
        public ActionResult Snimi(KlinikaUrediVM k)
        {
            if (!ModelState.IsValid)
            {
                k.OpstineList = UcitajOpstine();
                return(View("Uredi", k));
            }
            Klinika entity;

            if (k == null || k.Id == 0)
            {
                entity = new Klinika();
                ctx.Klinikas.Add(entity);
            }
            else
            {
                entity = ctx.Klinikas.Find(k.Id);
            }

            entity.Sifra         = k.Sifra;
            entity.Naziv         = k.Naziv;
            entity.OpstinaId     = k.OpstinaId;
            entity.Vrsta         = k.Vrsta;
            entity.Adresa        = k.Adresa;
            entity.IdBroj        = k.IdBroj;
            entity.PDVbroj       = k.PDVbroj;
            entity.ZdravInstitBr = k.ZdravInstitBr;
            entity.KoefRPV       = k.KoefRPV;
            entity.KoefPR        = k.KoefPR;
            entity.KoefGO        = k.KoefGO;
            entity.KoefBD42D     = k.KoefBD42D;
            entity.KoefBP42D     = k.KoefBP42D;
            entity.KoefRN        = k.KoefRN;
            entity.KoefNS        = k.KoefNS;
            entity.KoefNR        = k.KoefNR;
            entity.KoefRDP       = k.KoefRDP;
            entity.Valid         = k.Valid;

            ctx.SaveChanges();

            return(RedirectToAction("Index"));
        }