/// <summary>
        /// Helper function to look up unique assignmentId.
        /// Error return values:
        /// returns -1 if empty JArray (invalid classId),
        /// returns really large negative number if duplicate classIds found (this should never happen).
        /// </summary>
        /// <param name="classId"></param>
        /// <param name="category"></param>
        /// <param name="asgname"></param>
        /// <param name="contents"></param>
        /// <returns></returns>
        public int lookupAssignmentId(int classId, string category, string asgname)
        {
            using (Team10Context db = new Team10Context()) //Initialized instance of db context here to resolve dbcontext multithreading issues
            {
                if (classId < 0)
                {
                    return(-1);
                }

                var query = from cl in db.Class
                            join ass in db.Assignment
                            on cl.ClassId equals ass.ClassId
                            where ass.Name.Equals(asgname)
                            select ass.AssignId;

                return(query.Any() ?
                       query.Count() == 1 ? (int)query.First() : Int32.MinValue : -1);
            }
        }
 public DepartmentsController(Team10Context context)
 {
     _context = context;
 }
Exemple #3
0
 public ItemPurchasesController(Team10Context context)
 {
     _context = context;
 }
Exemple #4
0
 public CustomersController(Team10Context context)
 {
     _context = context;
 }
 public GiftShopsController(Team10Context context)
 {
     _context = context;
 }
 public ExhibitsController(Team10Context context)
 {
     _context = context;
 }
Exemple #7
0
 public EventsController(Team10Context context)
 {
     _context = context;
 }
 public TicketPurchasesController(Team10Context context)
 {
     _context = context;
 }
Exemple #9
0
 public StaffsController(Team10Context context)
 {
     _context = context;
 }
 public ItemsController(Team10Context context)
 {
     _context = context;
 }
 public PrivateEventsController(Team10Context context)
 {
     _context = context;
 }
 public CommonController()
 {
     //Initialize db context once in constructor
     db = new Team10Context();
 }
 public AnimalsController(Team10Context context)
 {
     _context = context;
 }