| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using LotteryWebApp.Controllers;
- using LotteryWebApp.Service;
- using Microsoft.AspNetCore.Mvc;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Threading.Tasks;
- namespace LotteryWebApp.Components
- {
- public class AdvertiseAreaModel
- {
- public List<Term> listTerm { get; set; }
- public long timeLeft { get; set; }
- public String timeExpired { get; set; }
- public String timeNow { get; set; }
- }
- public class AdvertiseArea : ViewComponent
- {
- APIFunctions api = new APIFunctions();
- public async Task<IViewComponentResult> InvokeAsync(List<Term> listTerm)
- {
- AdvertiseAreaModel model = new AdvertiseAreaModel();
- model.listTerm = listTerm;
- if (model.listTerm != null && model.listTerm.Count > 0)
- {
- model.timeLeft = BaseController.getCountTimeToTimestamp(model.listTerm[0].date_random);
- model.timeExpired = DateTime.ParseExact(model.listTerm[0].date_random, BaseController.formats, new CultureInfo("en-US"), DateTimeStyles.None).ToString("MM/dd/yyy HH:mm:ss");
- model.timeNow = DateTime.Now.ToString("MM/dd/yyy HH:mm:ss");
- }
- return View("AdvertiseArea", model);
- }
- }
- }
|