コード例 #1
0
        public async Task <ViewResult> Create(bool isSuccess = false, int sliciceId = 0)
        {
            var model = new SliciceModel();

            ViewBag.Albumi    = new SelectList(await _albumRepository.GetAlbum(), "AlbumId", "Naziv");
            ViewBag.Zamjene   = new SelectList(await _zamjenaRepository.GetZamjena(), "ZamjenaId", "Nacin");
            ViewBag.IsSuccess = isSuccess;
            ViewBag.SliciceId = sliciceId;
            return(View(model));
        }
コード例 #2
0
        public ActionResult AlbumDetails(int id)
        {
            AlbumDetailsViewModel model = EFMapper.EntityToModel(albumRepo.GetAlbum(id));

            #region notused
            //AlbumDetailsViewModel model = null;

            //using (PhotoExplorerEntities cx = new PhotoExplorerEntities())
            //{
            //    var entity = cx.Albums
            //        .Include(a => a.Photos)
            //        .Include(a => a.Comments)
            //        .FirstOrDefault(a => a.Id == id);

            //    model = new AlbumDetailsViewModel()
            //    {
            //        Id = entity.Id,
            //        Name = entity.Name,
            //        Comments = entity.Comments,
            //        DateCreated = entity.DateCreated,
            //        Description = entity.Description,
            //        Photos = entity.Photos,
            //        User = entity.User,
            //    };
            //}
            #endregion

            return(View(model));
        }
コード例 #3
0
 public JsonResult Index(int?id)
 {
     try
     {
         if (null != id)
         {
             Album album = repoAlbum.GetAlbum((int)id);
             return(this.Json(new { success = true, data = album }, JsonRequestBehavior.AllowGet));
         }
         var list = repoAlbum.FindAllAlbums().ToList();
         return(this.Json(new { data = list }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(this.Json(new { success = false, data = "" }, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #4
0
        public IActionResult Details(Guid?id)
        {
            var repository = new AlbumRepository();
            var album      = repository.GetAlbum(id.Value);
            var model      = new AlbumModel()
            {
                AlbumId = album.AlbumId,
                Title   = album.Title,
                Price   = album.Price,
                Artist  = new ArtistModel {
                    Name = album.Artist.Name
                }
            };

            ViewBag.QuantitySelectList = AlbumLogic.GetQuantitySelectList();
            return(View(model));
        }
コード例 #5
0
 public IActionResult Index()
 {
     var  cartItems = GetCartItemsFromSession();
     var model = new OrderModel();
     var orderDetails = new List<OrderDetailsModel>();
     var repository = new AlbumRepository();
     var orderTotal = Convert.ToDecimal(0);
     foreach (var cartItem in cartItems)
     {
         var detail = new OrderDetailsModel();
         var album = repository.GetAlbum(cartItem.AlbumId);
         detail.Album = new AlbumModel
         {
             Title = album.Title,
             Price = album.Price
         };
         detail.Quantity = cartItem.Quantity;
         orderDetails.Add(detail);
         orderTotal += album.Price * cartItem.Quantity;
     }
     model.OrderDetails = orderDetails;
     ViewBag.OrderTotal = orderTotal;
     return View(model);
 }
コード例 #6
0
ファイル: DataService.cs プロジェクト: Henri512/Music-Player
 public Album GetAlbum(string albumName, string author)
 {
     return(_albumRepository
            .GetAlbum(albumName, author)
            .SingleOrDefault());
 }
コード例 #7
0
        public AlbumWrapper GetAlbum(string trackId)
        {
            var getMusic = _startingRepository.GetAlbum(trackId);

            return(_mapper.Map <AlbumWrapper>(getMusic));
        }
コード例 #8
0
ファイル: AlbumController.cs プロジェクト: ajmoo93/MVCProject
 // GET: Album
 public ActionResult Index()
 {
     return(View(albumrepo.GetAlbum().Select(x => AlbumModelMapping.ModelToEntity(x)).ToList()));
 }