Exemple #1
0
        public async Task <bool> DeleteEvent(long id)
        {
            bool getState = false;

            try
            {
                //var remove = (from d in db.Events.Where(x => x.EventId == id) select d).FirstOrDefault();
                //if (remove != null)
                //{
                //    db.Events.Remove(remove);
                //    await db.SaveChangesAsync();
                //    getState = true;
                //}

                using (EventManagerDbEntities Context = new EventManagerDbEntities())
                {
                    Event eventDelete = new Event {
                        EventId = id
                    };
                    Context.Entry(eventDelete).State = EntityState.Deleted;
                    await Context.SaveChangesAsync();
                }
            }
            catch (Exception ex)
            {
                getState = false;
                throw ex;
            }
            return(getState);
        }
Exemple #2
0
 public EventUserRepository()
 {
     try
     {
         db = new EventManagerDbEntities();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
 public EventUserRepository(EventManagerDbEntities db)
 {
     try
     {
         this.db = db;
     }
     catch (Exception ex)
     {
         //log.Error(ex.Message);
         throw ex;
     }
 }
Exemple #4
0
 public AdminController()
 {
     try
     {
         db             = new EventManagerDbEntities();
         userRepository = new EventUserRepository();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public EventController()
 {
     try
     {
         db = new EventManagerDbEntities();
         eventRepository = new EventRepository();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public GenericRepository(EventManagerDbEntities db)
 {
     this.db = db;
     table   = db.Set <T>();
 }
 public GenericRepository()
 {
     this.db = new EventManagerDbEntities();
     table   = db.Set <T>();
 }