public ActionResult GetPage(int rowCount, int pageNum) { FindModel findModel = (FindModel)Session["ユーザー検索"]; findModel.GetPage(rowCount, pageNum); return(PartialView("_FindResult", findModel)); }
public async Task <IActionResult> Find([FromBody] FindModel model) { var question = _mapper.Map <Question>(model); var matchingQuestions = await _questionService.Find(question); return(Ok(_mapper.Map <QuestionModel[]>(matchingQuestions))); }
public HomeIndexViewModel(IEnumerable <JobPostingDTO> jobPostings, FindModel findModel, int timeToCache) { JobPostings = jobPostings; FindModel = findModel; TimeToCache = timeToCache; ImageName = GenerateRandomFrontImage(); }
public ActionResult Sort(string colName, string sortOrder) { FindModel findModel = (FindModel)Session["ユーザー検索"]; findModel.Sort(colName, sortOrder); //存在する場合、次の画面を表示する return(PartialView("_FindResult", findModel)); }
public List <Search> Get([ModelBinder] FindModel param) { if (param.TextSearch != "" || param.TextSearch != String.Empty || param.TextSearch != null) { return(GnamrBLL.Repository.Search(param)); } else { return(GnamrBLL.Repository.GetLast50()); } }
public IActionResult ShowMore() { Summoner summ = HttpContext.Session.GetSummoner(); Summoner summoner = _context.Summoners.Where(s => s.Id == summ.Id).FirstOrDefault(); int? matchIndex = HttpContext.Session.GetInt32("matchIndex"); if (summoner == null) { return(RedirectToAction("Index")); } if (matchIndex == null) { matchIndex = 5; } // Get match list from DB MatchesResponse matches = _context.MatchesResponses.Where(r => r.SummonerID == summoner.Id).FirstOrDefault(); matches.Matches = _context.Matches.Where(m => m.MatchesResponseID == matches.MatchesResponseID).OrderByDescending(m => m.Timestamp).ToList(); // Setup new match list Match_V4 matchv4 = new Match_V4(summoner.Region); MatchesResponse newMatches = matchv4.GetMoreMatchesByAccountID(summoner.AccountId, (int)matchIndex); foreach (Matches match in newMatches.Matches) { MatchDTO matchDTO = matchv4.GetMatchByMatchID(match.GameID); MatchDB matchDB = matchDTO.ConvertMatchDTOToDBv2(_context); matchDB = _context.MatchesDB.Where(m => m.GameID == matchDB.GameID).FirstOrDefault(); match.MatchesResponseID = matches.MatchesResponseID; match.MatchDB = matchDB; matches.Matches.Add(match); foreach (PlayerInfoDB p in matchDB.PlayerInfos) { if (p.SummonerID == summoner.Id) { summoner.Kills += p.Kills; summoner.Deaths += p.Deaths; summoner.Assists += p.Assists; } } } summoner.KDA = ((summoner.Kills + summoner.Assists) / (float)Math.Max(summoner.Deaths, 1)); _context.Summoners.Update(summoner); _context.SaveChanges(); FindModel fm = new FindModel { Name = summoner.Name, Region = summoner.Region }; return(RedirectToAction("Profile", fm)); }
public ActionResult Search(FindConditionModel Condition) { FindModel findModel = new FindModel(); if (Session["ユーザー検索"] != null) { findModel = (FindModel)Session["ユーザー検索"]; } else { findModel.ソート順 = "▲"; findModel.ソート列 = "ユーザーID"; } findModel.Find(Condition.ユーザーID, Condition.メールアドレス, Condition.ニックネーム, Condition.氏名, Condition.性別, Condition.生年月日, Condition.年齢, Condition.電話番号, Condition.郵便番号, Condition.住所, Condition.入社日, Condition.所属, Condition.役職, Condition.趣味, Condition.特技, Condition.座右銘); Session["ユーザー検索"] = findModel; return(PartialView("_FindResult", findModel)); }
public IActionResult TransactionView(Guid code, FindModel model) { if (model != null) { code = model.Code; } StatusNames statusNames = new StatusNames(); ViewBag.StatusEs = new SelectList(statusNames.GetStatuses().Where(s => s.Status != 1 && s.Status != 2), "Status", "Name"); decimal df = 0; var link = transactionLinkService.GetTransactionLinks().Where(s => s.LinkCode == code).FirstOrDefault(); var tr = transactionService.GetTransaction(link.TransactionID); TransactionDetails details = new TransactionDetails(); details.TransactionID = tr.Id; details.FirstName = tr.FirstName; details.LastName = tr.LastName; details.BuyerEmail = tr.BuyerEmail; details.ItemName = tr.ItemName; details.DescriptionOfItem = tr.DescriptionOfItem; details.Amount = tr.Amount; details.DeliveryType = tr.DeliveryTypeID == 1 ? "Free Delivery" : tr.DeliveryTypeID == 2 ? "Paid Delivery" : ""; details.Deliveryfee = tr.Deliveryfee != 0 ? tr.Deliveryfee : tr.Deliveryfee == 0 ? 0 : 0; details.DeliveryTime = tr.DeliveryTime; details.TermsOfReturns = tr.TermsOfReturns; details.ProductImageUrl = tr.ProductImageUrl; details.ProductImageUrl1 = tr.ProductImageUrl1; details.ProductImageUrl2 = tr.ProductImageUrl2; details.ProductImageUrl3 = tr.ProductImageUrl3; details.ProductImageUrl4 = tr.ProductImageUrl4; details.SellerName = tr.SellerName; details.SellerEmail = tr.SellerEmail; details.escrowfee = tr.escrowfee; details.Totalfee = tr.Totalfee; details.LinkCode = link.LinkCode; details.LinkID = link.Id; details.statusID = tr.Status; details.Status = tr.Status == 1 ? "<div style=\"color:red\">Pending<div>" : tr.Status == 2 ? "<div style=\"color:yellow\">Paid</div>" : tr.Status == 3 ? "<div style=\"color:purple\">Shipped</div>" : tr.Status == 4 ? "<div style=\"color:green\">Receieved</div>" : ""; return(View(details)); }
public IActionResult Find(FindModel model) { var web = new HtmlWeb(); var originalDoc = web.Load(model.OriginUrl); var originalNode = originalDoc.GetElementbyId(model.OriginId); if (originalNode == null) { throw new Exception("Element not found"); } var sampleDoc = web.Load(model.SampleUrl); var sampleNodes = sampleDoc.DocumentNode.Descendants(); var result = FinderService.Find(sampleNodes, originalNode); if (result.Element == null) { throw new Exception("No matching elements"); } return(View(result)); }
public JsonResult GetUsers(FindModel model) { LoggedUserInfo userInfo = _userCache.Get(model.UserId); if (userInfo != null) { Result <List <UserNameInfo> > users = _dataService.GetUsers(userInfo.Token, model.Filter); if (users.Data != null) { return(Json(users.Data, JsonRequestBehavior.AllowGet)); } else { if (users.Error.IndexOf("401") != -1 || users.Error.IndexOf("403") != -1) { _userCache.Delete(model.UserId); } return(Json(users.Error, JsonRequestBehavior.AllowGet)); } } return(Json(ConstStrings.UsersError401, JsonRequestBehavior.AllowGet)); }
public async Task <IEnumerable <FindModel> > Post(FindModel query) { return(mapper.Map <IEnumerable <FindModel> >(await findService.GetUsersBy(d => d.FirstName == query.FirstName && d.LastName == query.LastName && d.MeetGoal == d.MeetGoal && d.Other == d.Other && d.IsOnline == query.IsOnline && d.Interests == d.Interests && d.BirthDate == d.BirthDate))); }
public async Task <IEnumerable <FindModel> > Get(FindModel query) { return(mapper.Map <IEnumerable <FindModel> >(await findService.GetUsersBy(d => d.FirstName == query.FirstName && d.LastName == query.LastName && d.IsAnonymous == false))); }
//Func<int,int, int> hansOgGrethe .... //Func<int, string> navn static void Main(string[] args) { Console.WriteLine("Hello World!"); #region data List <Car> carsList = new List <Car>() { new Car() { id = 1, model = "rio", brand = "kia", year = 2006, price = 250000, color = "red" }, new Car() { id = 2, model = "rio", brand = "kia", year = 2007, price = 265000, color = "black" }, new Car() { id = 3, model = "panda", brand = "fiat", year = 2017, price = 265000, color = "black" }, new Car() { id = 4, model = "panda", brand = "fiat", year = 2017, price = 365000, color = "yellow" }, new Car() { id = 5, model = "S40", brand = "volvo", year = 2018, price = 665000, color = "white" }, new Car() { id = 6, model = "S65", brand = "volvo", year = 2018, price = 600000, color = "white" }, new Car() { id = 7, model = "gorm", brand = "ferrari", year = 2000, price = 4665000, color = "white" }, new Car() { id = 8, model = "knud", brand = "ferrari", year = 2019, price = 4665000, color = "white" }, }; #endregion data #region lambda udledes Car cc = new Car(); FindModel variabel = new FindModel(testing); // var1 er en delegate variabel FindModel var1 = testing; // svare til jeg skrev en metode her - signatur var1(cc); // Invoke signatur (kalder metoden testing) - testing(cc); testing(cc); int tal = 5; // Hvorfor - I kan kun se effekten i metoder //C#1.0 delegate type and delegate instance FindModel fun1 = new FindModel(testing); // testing er en metode med den signatur //C#2.0 method group conversion - Der kan være flere metoder FindModel fun2 = testing; // flere metoder syntax : fun2 += testing2; //C#2.0 generic delegate and anonymous method //Func<string, int> fun3 = delegate (string text) { return text.Length; }; FindModel fun3 = delegate(Car myCar) { return(myCar); }; //C#3.0 lamba expression FindModel fun4 = (Car myCar) => { return(myCar); }; //C#3.0 simple expression, no need braces FindModel fun5 = (Car myCar) => myCar; //C#3.0 let the compiler infer the parameter type FindModel fun6 = (myCar) => myCar; //C#3.0 no need unnecessary parentheses FindModel fun7 = myCar => myCar; #endregion lambda udledes #region hente data fra en colleciton old school before LINQ and with LINQ List <Car> tempList = new List <Car>(); foreach (Car obj in carsList) { if (obj.model == "rio") { tempList.Add(obj); } } #endregion #region calculate Calculate cal1 = metode; Console.WriteLine(cal1(3, 6)); cal1 = subtract; Console.WriteLine(cal1(3, 6)); metode(3, 6); subtract(3, 6); // var linq1 = carsList.Where(x => x.model.All()) //var linq2 = carsList.Where(x => x.model.Any()) //var linq3 = carsList.Where(x => x.model.Distinct()) //var linq12 = carsList.VoresMetode(511); int gg = 9; // invoke multi multi(metode, 3, 5); multi(subtract, 33, 11); multi(gange, 44, 5); multi(delegate(int t1, int t2) { return(t1 / t2); }, 5, 5); multi((int t1, int t2) => { return(t1 + t2); }, 6, 12); // lambda udtryk multi((int t1, int t2) => { return(t1 + t2); }, 6, 12); #endregion #region #endregion #region #endregion #region #endregion Console.ReadKey(); }
public async Task <object[]> Find(string typeIdentifier, [FromBody] FindModel filter) { return(await schemaRegistry.GetConnector(typeIdentifier).Search(filter.Filters, filter.Sorts, filter.From, filter.Count).ConfigureAwait(false)); }
public IActionResult Profile(FindModel fm) { // TODO: Add option to select region // Currently just using NA region, since that's what I am on. Champion_Mastery_V4 championMastery = new Champion_Mastery_V4("na1"); Match_V4 matchv4 = new Match_V4("na1"); // Get summoner info Summoner summoner = _context.Summoners.Where(s => s.Name == fm.Name).SingleOrDefault(); if (summoner == null) { Summoner_V4 summonerv4 = new Summoner_V4("na1"); summoner = summonerv4.GetSummonerByName(fm.Name); summoner.Region = fm.Region; _context.Summoners.Add(summoner); _context.SaveChanges(); summoner = _context.Summoners.Where(s => s.Name == fm.Name).SingleOrDefault(); } // Get list of masteries by summoner id List <ChampionMastery> masteries = championMastery.GetChampionMasteryById(summoner.Id); // List will be top 3 champs by mastery ChampionInfo list = new ChampionInfo(); // Get top 3 champs by mastery for (int i = 0; i < 3; i++) { foreach (KeyValuePair <string, Champion> champ in _allChamps.Data) { if (champ.Value.Key == masteries[i].ChampionID.ToString()) { champ.Value.Rank = i; list.Champions.Add(champ.Key, champ.Value); break; } } } // Get matchlist by account id MatchesResponse matches = _context.MatchesResponses.Where(r => r.SummonerID == summoner.Id).FirstOrDefault(); if (matches == null) { int k, d, a; k = d = a = 0; matches = matchv4.GetMatchesByAccountID(summoner.AccountId); matches.SummonerID = summoner.Id; foreach (Matches match in matches.Matches) { MatchDB matchDB = _context.MatchesDB.Where(m => m.GameID == long.Parse(match.GameID)).FirstOrDefault(); if (matchDB == null) { MatchDTO matchDTO = matchv4.GetMatchByMatchID(match.GameID); matchDB = matchDTO.ConvertMatchDTOToDBv2(_context); } else { matchDB.PlayerInfos = _context.PlayerInfoDBs.Where(p => p.GameID == matchDB.GameID).OrderBy(p => p.ParticipantID).ToList(); matchDB.Teams = _context.TeamStatsDBs.Where(t => t.GameID == matchDB.GameID).OrderBy(t => t.TeamID).ToList(); } match.MatchDB = matchDB; foreach (PlayerInfoDB p in matchDB.PlayerInfos) { if (p.SummonerID == summoner.Id) { k += p.Kills; d += p.Deaths; a += p.Assists; } } } summoner.Kills = k; summoner.Deaths = d; summoner.Assists = a; summoner.KDA = ((k + a) / (float)d); _context.Summoners.Update(summoner); _context.MatchesResponses.Add(matches); _context.SaveChanges(); } else { matches.Matches = _context.Matches.Where(m => m.MatchesResponseID == matches.MatchesResponseID).OrderByDescending(m => m.Timestamp).ToList(); foreach (Matches match in matches.Matches) { MatchDB matchDB = _context.MatchesDB.Where(m => m.GameID == long.Parse(match.GameID)).FirstOrDefault(); matchDB.Teams = _context.TeamStatsDBs.Where(t => t.GameID == matchDB.GameID).OrderBy(t => t.TeamID).ToList(); matchDB.PlayerInfos = _context.PlayerInfoDBs.Where(p => p.GameID == matchDB.GameID).OrderBy(p => p.ParticipantID).ToList(); match.MatchDB = matchDB; } } Dictionary <int, string> championIDs = new Dictionary <int, string>(); foreach (Champion c in _allChamps.Data.Values) { championIDs.Add(int.Parse(c.Key), c.Id); } ViewModelProfile viewModel = new ViewModelProfile { Summoner = summoner, Masteries = masteries, ChampionIDs = championIDs, Info = list, Matchlist = matches }; HttpContext.Session.SetInt32("matchIndex", matches.Matches.Count); HttpContext.Session.SetSummoner(summoner); return(View(viewModel)); }
public Task <object[]> Find(string typeIdentifier, [FromBody] FindModel filter) { return(impl.Find(typeIdentifier, filter)); }
public IActionResult FindTransaction() { FindModel model = new FindModel(); return(View(model)); }