public bool DeleteSession(int sessionId) { //Check for registrations SessionCartManager sessMgr = new SessionCartManager(); var registrations = sessMgr.GetAllUsersBySession(sessionId); if (registrations == null) { using (wsadDbContext context = new wsadDbContext()) { Session sessionDTO = context.Sessions.Find(sessionId); context.Sessions.Remove(sessionDTO); context.SaveChanges(); } return(true); } else { return(false); } }
// GET api/<controller>/5 public IEnumerable <SessionCart> Get(int id) { SessionCartManager sessCrtMgr = new SessionCartManager(); //Search username var results = sessCrtMgr.GetAllUsersBySession(id); return(results); }
// GET api/<controller> public IEnumerable <SessionCart> Get(string username) { SessionCartManager sessCrtMgr = new SessionCartManager(); //Search username var results = sessCrtMgr.GetAllSessionsByUser(username, null); return(results); }
public ActionResult GetRegistrations(int id) { SessionCartManager cartMgr = new SessionCartManager(); IQueryable <SessionCart> allItems = cartMgr.GetAllSessionsByUser(null, id); List <SessionCartViewModel> cartVM = new List <SessionCartViewModel>(); foreach (var item in allItems) { cartVM.Add(new SessionCartViewModel(item)); } return(PartialView("_UserSessions", cartVM)); }
// DELETE api/<controller>/5 public void Delete(int id) { SessionCartManager sessCrtMgr = new SessionCartManager(); sessCrtMgr.DeleteRegistration(id); }