/// <summary> /// dohvati jedan po primary key-u /// </summary> /// <param name="guid"></param> /// <returns></returns> public CvCompetencesRates Get(int Id) { CvCompetencesRates item = null; using (Entities data = new Entities()) { item = data.CvCompetencesRates.Where(r => r.Id == Id).FirstOrDefault(); } return(item); }
/// <summary> /// obriši item /// nije brisanje već postavljanje Deleted polja na true /// </summary> /// <param name="item">instanca entity objekta</param> /// <returns></returns> public bool Delete(CvCompetencesRates item) { bool uspjelo = false; using (KaFotkaEntities data = new KaFotkaEntities()) { item.Deleted = true; data.Entry <CvCompetencesRates>(item).State = System.Data.EntityState.Modified; data.SaveChanges(); uspjelo = true; } return(uspjelo); }
/// <summary> /// spremi item /// insert ako nema Id /// update ako ima Id /// </summary> /// <param name="item">instanca entity objekta</param> /// <returns></returns> public bool Save(CvCompetencesRates item) { bool uspjelo = false; using (Entities data = new Entities()) { data.CvCompetencesRates.Add(item); //ako ima Id onda je update if (item.Id != null) { data.Entry <CvCompetencesRates>(item).State = System.Data.EntityState.Modified; } data.SaveChanges(); uspjelo = true; } return(uspjelo); }