public void CreateOrUpdate(StrucnaSprema strucnaSprema)
 {
     if (GetByID(strucnaSprema.ID) is null)
     {
         _db.Insert <StrucnaSprema>(strucnaSprema);
     }
     else
     {
         _db.Update <StrucnaSprema>(strucnaSprema);
     }
 }
예제 #2
0
        public ActionResult SpasiIzmjenu_SP(StrucnaSprema Podaci)
        {
            StrucnaSprema Izmjenuti = CTX.StrucneSpreme.Where(x => x.Id == Podaci.Id).FirstOrDefault();

            if (!ModelState.IsValid)
            {
                return(View("Dodavanje_SP", Podaci));
            }
            Izmjenuti.Naziv = Podaci.Naziv;

            CTX.SaveChanges();

            return(JavaScript("window.location = '" + Url.Action("Index") + "'"));
        }
        private void NapuniSS()
        {
            List <StrucnaSprema> lista  = Service_DA.StrucneSpremeSelectAll();
            StrucnaSprema        prazno = new StrucnaSprema();

            prazno.StrucnaSpremaID = 0;
            prazno.Skracenica      = "-";
            prazno.Naziv           = "-";

            lista.Insert(0, prazno);
            ddlStrucneSpreme.DataSource     = lista;
            ddlStrucneSpreme.DataValueField = "StrucnaSpremaID";
            ddlStrucneSpreme.DataTextField  = "Skracenica";
            ddlStrucneSpreme.DataBind();
        }
예제 #4
0
        public StrucnaSprema GetDataSource(int iD)
        {
            StrucnaSprema result;

            if (strucnaSpremaID == 0)
            {
                result       = new StrucnaSprema();
                result.Opis  = "";
                result.Naziv = "";
            }
            else
            {
                result = ss.GetByID(strucnaSpremaID);
            }
            return(result);
        }
예제 #5
0
        public ActionResult Spasi_SP(StrucnaSprema Nova_SP)
        {
            bool Pronadjeno = false;

            if (!ModelState.IsValid)
            {
                return(View("Dodavanje_SP", Nova_SP));
            }
            foreach (StrucnaSprema JM in CTX.StrucneSpreme)
            {
                if (JM.Naziv == Nova_SP.Naziv)
                {
                    Pronadjeno = true;
                }
            }

            if (Pronadjeno == false)
            {
                CTX.StrucneSpreme.Add(Nova_SP);
                CTX.SaveChanges();
            }

            return(JavaScript("window.location = '" + Url.Action("Index") + "'"));
        }
 public void Delete(StrucnaSprema strucnaSprema)
 {
     _db.Delete <StrucnaSprema>(strucnaSprema);
 }
 public void Update(StrucnaSprema strucnaSprema)
 {
     _db.Update <StrucnaSprema>(strucnaSprema);
 }
 public void Create(StrucnaSprema strucnaSprema)
 {
     _db.Insert <StrucnaSprema>(strucnaSprema);
 }
예제 #9
0
 void LoadData(int Id)
 {
     strucnaSprema      = GetDataSource(Id);
     txtOpis.EditValue  = strucnaSprema.Opis;
     txtNaziv.EditValue = strucnaSprema.Naziv;
 }
예제 #10
0
        public ActionResult Edituj_SP(int id)
        {
            StrucnaSprema Model = CTX.StrucneSpreme.Where(x => x.Id == id).FirstOrDefault();

            return(View("Edituj_SP", Model));
        }
예제 #11
0
        public ActionResult Dodaj_SP()
        {
            StrucnaSprema Model = new StrucnaSprema();

            return(View("Dodavanje_SP", Model));
        }