Ejemplo n.º 1
0
        public ActionResult Details(int id)
        {
            var gig = _unitOfWork.Gigs.GetGig(id);

            if (gig == null)
            {
                return(HttpNotFound());
            }

            var viewModel = new DetailsDto {
                Gig = gig
            };

            if (User.Identity.IsAuthenticated)
            {
                var userId = User.Identity.GetUserId();

                viewModel.AmIFollowing = _unitOfWork.Relationships.IsFollowing(gig.ArtistId, userId) != null;

                viewModel.AmIGoing = _unitOfWork.Attendances.IsGoing(gig.Id, userId) != null;

                viewModel.AmI = (User.Identity.GetUserId() == gig.ArtistId) ? true : false;
            }

            return(View("Details", viewModel));
        }
        public IActionResult add(DetailsModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    DetailsDto dto = new DetailsDto();
                    dto.details_id = model.details_id;
                    dto.value0     = model.value0;
                    dto.value1     = model.value1;
                    dto.value2     = model.value2;
                    dto.value3     = model.value3;
                    dto.value4     = model.value4;

                    _detailsService.save(dto);
                    AlertHelper.setMessage(this, "Details saved successfully.", messageType.success);
                    return(RedirectToAction("index"));
                }
            }
            catch (Exception ex)
            {
                AlertHelper.setMessage(this, ex.Message, messageType.error);
            }

            return(View(model));
        }
Ejemplo n.º 3
0
        public void copy(ref Details details, DetailsDto details_dto)
        {
            details.details_id = details_dto.details_id;
            details.value0     = details_dto.value0;

            details.value1 = details_dto.value1;

            details.value4 = details_dto.value4;

            details.value2 = details_dto.value2;

            details.value3 = details_dto.value3;
        }
Ejemplo n.º 4
0
        public JsonResult Details(string id)
        {
            ApiDetailsDto detailsDto;

            try
            {
                detailsDto = _api.GetDetails(id);
            }
            catch (WebException exc)
            {
                _logger.Error(exc);
                return(Json(new ErrorDto()
                {
                    ErrorMessage = exc.Message
                }, JsonRequestBehavior.AllowGet));
            }
            if (detailsDto.Response)
            {
                var responseDto = new DetailsDto()
                {
                    Actors     = detailsDto.Actors,
                    Awards     = detailsDto.Awards,
                    Country    = detailsDto.Country,
                    Director   = detailsDto.Director,
                    Genre      = detailsDto.Genre,
                    Language   = detailsDto.Language,
                    Metascore  = detailsDto.Metascore,
                    Poster     = detailsDto.Poster,
                    Plot       = detailsDto.Plot,
                    Rated      = detailsDto.Rated,
                    Title      = detailsDto.Title,
                    Released   = detailsDto.Released,
                    Writer     = detailsDto.Writer,
                    Runtime    = detailsDto.Runtime,
                    Type       = detailsDto.Type,
                    Year       = detailsDto.Year,
                    imdbID     = detailsDto.ImdbID,
                    imdbRating = detailsDto.ImdbRating,
                    imdbVotes  = detailsDto.ImdbVotes
                };
                return(Json(responseDto, JsonRequestBehavior.AllowGet));
            }
            return(Json(new ErrorDto()
            {
                ErrorMessage = detailsDto.Error
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
 public JsonResult Details(string id)
 {
     ApiDetailsDto detailsDto;
     try
     {
         detailsDto = _api.GetDetails(id);
     }
     catch (WebException exc)
     {
         _logger.Error(exc);
         return Json(new ErrorDto()
         {
             ErrorMessage = exc.Message
         }, JsonRequestBehavior.AllowGet);
     }
     if (detailsDto.Response)
     {
         var responseDto = new DetailsDto()
         {
             Actors = detailsDto.Actors,
             Awards = detailsDto.Awards,
             Country = detailsDto.Country,
             Director = detailsDto.Director,
             Genre = detailsDto.Genre,
             Language = detailsDto.Language,
             Metascore = detailsDto.Metascore,
             Poster = detailsDto.Poster,
             Plot = detailsDto.Plot,
             Rated = detailsDto.Rated,
             Title = detailsDto.Title,
             Released = detailsDto.Released,
             Writer = detailsDto.Writer,
             Runtime = detailsDto.Runtime,
             Type = detailsDto.Type,
             Year = detailsDto.Year,
             imdbID = detailsDto.ImdbID,
             imdbRating = detailsDto.ImdbRating,
             imdbVotes = detailsDto.ImdbVotes
         };
         return Json(responseDto, JsonRequestBehavior.AllowGet);
     }
     return Json(new ErrorDto()
     {
         ErrorMessage = detailsDto.Error
     }, JsonRequestBehavior.AllowGet);
 }
        public void save(DetailsDto Details_dto)
        {
            try
            {
                using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required))
                {
                    Details Detail = new Details();
                    var     designation_position = _detailsRepository.getAll();

                    _detailsMaker.copy(ref Detail, Details_dto);
                    _detailsRepository.insert(Detail);

                    tx.Complete();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 7
0
        public static async Task <T> SetGet <T>(int id, string date, IEntityDetailsService service, IEntityException exceptionService, QueriesToPassDto queryDto)
        {
            exceptionService.DoesExist(id);

            var dateParsed = DateTimeExtensions.FromWebFormat(date);
            var entity     = await service.ByIdAndDate(queryDto.SqlFunctionById, id, dateParsed).ToListAsync();

            string   startConnectionString = entity.ToList()[1][IndexStartConnectionInSQLTable];
            string   endConnectionString   = entity.ToList()[1][IndexEndConnectionInSQLTable];
            DateTime?endConnection         = null;

            if (!string.IsNullOrWhiteSpace(endConnectionString) && endConnectionString != GlobalConstants.EmptyEndConnectionDisplay)
            {
                endConnection = DateTimeExtensions.FromSqlFormat(endConnectionString);
            }

            var dto = new DetailsDto()
            {
                Id              = id,
                Date            = date,
                Entity          = entity,
                StartConnection = DateTimeExtensions.FromSqlFormat(startConnectionString),
                EndConnection   = endConnection,
            };

            if (queryDto.SqlFunctionContainer != null)
            {
                dto.Container = service.GetContainer(queryDto.SqlFunctionContainer, id, dateParsed);
            }

            if (queryDto.SqlFunctionActiveSE != null)
            {
                var subEntities = await service.GetSubEntities(queryDto.SqlFunctionActiveSE, id, dateParsed, 1).ToListAsync();

                dto.SubEntityCount = subEntities.Count;
            }

            return(AutoMapperConfig.MapperInstance.Map <T>(dto));
        }
        public void update(DetailsDto Details_dto)
        {
            try
            {
                using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required))
                {
                    Details Detail = _detailsRepository.getById(Details_dto.details_id);

                    if (Detail == null)
                    {
                        throw new ItemNotFoundException($"Details with ID {Details_dto.details_id} doesnot Exit.");
                    }

                    _detailsMaker.copy(ref Detail, Details_dto);
                    _detailsRepository.update(Detail);
                    tx.Complete();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }