public void CreateOrUpdate(StrucnaSprema strucnaSprema) { if (GetByID(strucnaSprema.ID) is null) { _db.Insert <StrucnaSprema>(strucnaSprema); } else { _db.Update <StrucnaSprema>(strucnaSprema); } }
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(); }
public StrucnaSprema GetDataSource(int iD) { StrucnaSprema result; if (strucnaSpremaID == 0) { result = new StrucnaSprema(); result.Opis = ""; result.Naziv = ""; } else { result = ss.GetByID(strucnaSpremaID); } return(result); }
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); }
void LoadData(int Id) { strucnaSprema = GetDataSource(Id); txtOpis.EditValue = strucnaSprema.Opis; txtNaziv.EditValue = strucnaSprema.Naziv; }
public ActionResult Edituj_SP(int id) { StrucnaSprema Model = CTX.StrucneSpreme.Where(x => x.Id == id).FirstOrDefault(); return(View("Edituj_SP", Model)); }
public ActionResult Dodaj_SP() { StrucnaSprema Model = new StrucnaSprema(); return(View("Dodavanje_SP", Model)); }