public IActionResult GetIndents(int indentid, string account, int seedid, IndentStatus status) { GerIndentModel gerIndent = new GerIndentModel { IndentID = indentid, Account = account, SeedID = seedid, Status = status, }; if (gerIndent == null) { return(BadRequest()); } var model = _productRepository.GetIndents(gerIndent.Account); var result1 = new List <IndentDto>(); var model2 = _productRepository.GetIndents(gerIndent.Account, gerIndent.Status); if (gerIndent.Status >= 0) { foreach (Indent i in model) { result1.Add(new IndentDto { Account = i.Account, Amount = i.Amount, CreatTIme = System.DateTime.Now, Count = i.Count, Price = i.Price, FinishedTime = System.DateTime.Now, IndentID = i.IndentID, SeedID = i.SeedID, Status = i.Status, SellerID = i.SellerID }); } } else { foreach (Indent i in model2) { result1.Add(new IndentDto { Account = i.Account, Count = i.Count, Price = i.Price, Amount = i.Amount, CreatTIme = System.DateTime.Now, FinishedTime = System.DateTime.Now, IndentID = i.IndentID, SeedID = i.SeedID, Status = i.Status, SellerID = i.SellerID }); } } return(Ok(result1)); // return Ok(_Mapper.Map<IndentDto>(_productRepository.GetIndents(gerIndent.Account, gerIndent.Status))); }
public IEnumerable <Indent> GetIndents(string account, IndentStatus status = IndentStatus.所有状态) { if (status == IndentStatus.所有状态) { return(_myContext.Indents.Where(x => x.Account == account).OrderBy(x => x.Account).ToList <Indent>()); } else { return(_myContext.Indents.Where(x => x.Account.Equals(account)).OrderBy(x => x.Account).ToList <Indent>()); } }