Exemplo n.º 1
0
        public ActionResult Create()
        {
            ViewBag.Filters = FiltersMapper.MapRange(_photosService.Filters);
            //ViewBag.Tags = _tagsMapper.MapRange(_photosService.Tags);

            return(View(UsersMapper.Map(_currentUserService.GetDTO)));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Edit(int id)
        {
            PhotoDTO item = await _photosService.GetAsync(id);

            UserViewModel user = UsersMapper.Map(_usersService.Get(item.Owner.UserName));

            if (item != null && user != null && (user.UserName == item.Owner.UserName || User.IsInRole("Admin")))
            {
                ViewBag.LikesCount = item.Likes.Count();
                ViewBag.Filters    = FiltersMapper.MapRange(_photosService.Filters);
                //ViewBag.Tags = _tagsMapper.MapRange(_photosService.Tags);

                return(View(PhotosMapper.Map(item)));
            }

            return(RedirectToAction("Details", "Photos", new { id = item.Id }));
        }