Save to Database at auction end

Asked

Viewed 122 times

0

I am developing an auction site on ASP.NET MVC4 and EF, at this time already makes bids and has a time stopwatch.

The problem now is: how do I record the data when the time runs out? I’ve thought about making a Trigger in comics, but I don’t think it’s gonna work.

I guess I’ll have to have an IIS server script which detects that time has passed and writes the data to the BD, but how do I do this?

I have the timer in Javascript:

<script type="text/javascript"> 
    $('#countdown').countdown({ until: '@timeSpan', format: 'DHMS' }); 
</script> 
  • It is not better to time by Javascript and submit an Ajax request?

  • I have the timer in Javascript. <script type="text/javascript"> $('#Countdown'). Countdown({ until: '@timeSpan', format: 'DHMS' }); </script>

1 answer

2

In the jQuery Countdown documentation, there is a parameter called expiryUrl. It can be used to make an Ajax request for some Controller your.

<script type="text/javascript"> 
    $('#countdown').countdown({ 
        until: '@timeSpan', 
        format: 'DHMS',
        expiryUrl: '˜/MeuController/ActionAposExpirarTempo/?parametro=valor' 
    }); 
</script>

Then just create the Action in the Controller:

public JsonResult ActionAposExpirarTempo(String parametro) {
    // Faça alguma coisa aqui relacionada com a sua lógica

    return Json(new { status = "Ok"}, JsonRequestBehavior.AllowGet);
}

It’s just an example. It doesn’t necessarily need to return a JSON.

  • I understand your answer, but how do I make this method run when the chronometer reaches zero without having a user iteration with the site?

  • It decreases alone, no?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.