예제 #1
0
        bool CreateNewState()
        {
            DashboardBP_State state = new DashboardBP_State
            {
                active     = true,
                datetime   = DateTime.Now,
                numberWeek = new Wiki.Models.WeekNumber().GetNowWeekNumber()
            };

            using (PortalKATEKEntities db = new PortalKATEKEntities())
            {
                db.DashboardBP_State.Add(state);
                db.SaveChanges();
            }
            return(true);
        }
예제 #2
0
 bool DeactiveState()
 {
     using (PortalKATEKEntities db = new PortalKATEKEntities())
     {
         try
         {
             DashboardBP_State state = db.DashboardBP_State.First(d => d.active == true);
             state.active          = false;
             db.Entry(state).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
         }
         catch
         {
         }
     }
     return(true);
 }