/// <summary> /// 用户图片列表 /// </summary> /// <returns></returns> public IActionResult CustomerPicList() { var isAuthenticated = HttpContext.User.Identity.IsAuthenticated; if (isAuthenticated) { var CustomerId = HttpContext.User.Claims.SingleOrDefault(s => s.Type == ClaimTypes.Sid).Value; int customerId = int.Parse(CustomerId); var customer = _customerRepository.GetById(customerId); try { //Core到现在还不支持延迟加载所以手写 //List<Picture> pictures = customer.Pictures.Where(x => x.isDeleted == false).OrderByDescending(x => x.updatedOn).ToList(); List <Picture> pictures = _pictureRepository.Table.Where(x => x.CustomerId == customerId) .OrderByDescending(x => x.UpdatedOn).ToList(); PictureListModel picList = new PictureListModel(); picList.Pictures = new List <PictureModel>(); foreach (var p in pictures) { var picmodel = new PictureModel() { Id = p.Id, CustomName = p.CustomName, Url = _localDir.PictureUrlDir + p.LocalName }; picList.Pictures.Add(picmodel); } return(View(picList)); } catch (Exception ex) { return(View(null)); } } return(RedirectToAction(nameof(Index))); }
public PictureEntity MapToEntity(PictureListModel detail) { throw new NotImplementedException(); }