Esempio n. 1
0
        public string GetAuctionsForArtist()
        {
            EntityAllResponse <AuctionListArtistViewModel> AuctoinRes =
                new EntityAllResponse <AuctionListArtistViewModel>();

            string UserId = User.Identity.GetUserId();
            var    res    = _actionSrv.GetAuctionsForArtist(UserId);

            AuctoinRes.Entities = res.Entities.Select(a => new AuctionListArtistViewModel()
            {
                Id             = a.AuctionId,
                AuctionName    = a.AuctionName,
                AuctionStatus  = setAuctionStatusForArtist(a.AuctionStatus),
                CloseDate      = a.CloseDate.Value.ToShortDateString(),
                OpenDate       = a.OpenDate.Value.ToShortDateString(),
                PickWinnerDate = a.PickWinnerDate.Value.ToShortDateString(),
                Won            = a.WinnerArtist?.Id == UserId,
                SketchSent     = a.Sketches?.Any(s => s.ArtistID == UserId)
            });
            AuctoinRes.Message = res.Message;
            AuctoinRes.Success = res.Success;
            return(JsonConvert.SerializeObject(AuctoinRes));
        }