Example #1
0
 public static void ChangeStatus(SurveyHedear survey)
 {
     try
     {
         using (HomeCommitteeDBEntities db = new HomeCommitteeDBEntities())
         {
             db.SurveyHedear.AddOrUpdate(survey);
             // db.Entry(survey).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #2
0
        //get all
        //get by id
        //add
        //update
        //delete

        //todo
        //public static long GetSurvey(int id)
        //{
        //    using (HomeCommitteeDBEntities db = new HomeCommitteeDBEntities())
        //    {
        //        return db.SurveyHedears.Where();
        //    }
        //}

        public static long AddNewSurveyHeader(SurveyHedear surveyHedear)
        {
            try
            {
                using (HomeCommitteeDBEntities db = new HomeCommitteeDBEntities())
                {
                    db.SurveyHedear.Add(surveyHedear);
                    db.SaveChanges();
                    return(surveyHedear.SurveyHedearId);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public static void DeleteSurvey(SurveyHedear survey)
        {
            try
            {
                using (HomeCommitteeDBEntities db = new HomeCommitteeDBEntities())
                {
                    db.Entry(survey).State = EntityState.Deleted;
                    List <SurveyDetails> sd = db.SurveyDetails.Where(s => s.SurveyHedearId == survey.SurveyHedearId).ToList();
                    foreach (var item in sd)
                    {
                        db.Entry(item).State = EntityState.Deleted;
                    }

                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #4
0
 public static void DeleteSurveyDetails(SurveyHedear survey)
 {
     using (HomeCommitteeDBEntities db = new HomeCommitteeDBEntities())
     {
     }
 }