c# - How would I make an sql MVC query pertaining to 3 tables with if and @@ logic? -
i using entity framework , asp.net mvc 4. tables set this
computer table-----
[key] (int) computerid (string) computername (string) department ticket table----
[key] (int) ticketid [foreign key] (int) computerid (datetime) downtimestamp (int) runningstatus update ticket table---
[key] (int) updateid [foreign key] (int) ticketid (datetime) updatetimestamp when ticket created, ticket running status set 1, computer down
i update tickets running status every time there update radio buttons, 2 computer restarted, 3 waiting parts , 4 maintenance on site.
i have index view of current tickets refreshes every minute, displaying computers down.
i have query joins 3 tables, question is, how make query includes of tickets have condition if running status set 2, keep ticket 2 minutes after update timestamp.
i think query need this:
var tickets = _db.tickets .where(x => !(x.runningstatus == 2 && datetime.now.subtract(t.downtimestamp).seconds >= 2 *60)); if isn't want, please give example or describe question in more detail.
Comments
Post a Comment