예제 #1
0
        public async Task <Response> AddAsync([FromBody] TheatrePlay theatrePlay)
        {
            theatrePlay.Id = Guid.NewGuid();
            await m_theatrePlayService.CreateTheatrePlayAsync(theatrePlay);

            return(new Response
            {
                IsSuccesfull = true,
                Message = theatrePlay.Id.ToString()
            });
        }
        public TheatrePlayDetailPage()
        {
            InitializeComponent();

            var play = new TheatrePlay
            {
                Title       = "Play 1",
                Description = "This is an film description."
            };

            viewModel      = new TheatrePlayDetailViewModel(play);
            BindingContext = viewModel;
        }
예제 #3
0
 public async Task CreateTheatrePlayAsync(TheatrePlay theatrePlay)
 {
     try
     {
         await m_repository.CreateAsync(theatrePlay);
     }
     catch (ValidationException e)
     {
         m_logger.LogWarning(e, "A validation failed");
         throw;
     }
     catch (Exception e) when(e.GetType() != typeof(ValidationException))
     {
         m_logger.LogCritical(e, $"Unexpected Exception while trying to create a TheatrePlay with the properties : {JsonConvert.SerializeObject(theatrePlay, Formatting.Indented)}");
         throw;
     }
 }
예제 #4
0
파일: HomeController.cs 프로젝트: mdLn1/SDP
        // return view to allow user to pick a date
        public IActionResult SelectDate(int?Id)
        {
            if (Id == null)
            {
                return(NotFound());
            }
            var play = _context.Plays.Include(x => x.Performances).Include(x => x.Reviews)
                       .FirstOrDefault(x => x.Id == Id);

            var foundDates = play.Performances.Where(x => x.Date > DateTime.Now).OrderBy(x => x.Date).ToList();

            TheatrePlay currentPlay = _mapper.Map <TheatrePlay>(play);

            currentPlay.Performances = foundDates;
            currentPlay.Reviews      = play.Reviews.ToList();

            return(View(currentPlay));
        }
 public TheatrePlayDetailViewModel(TheatrePlay play = null)
 {
     Title       = play?.Title;
     TheatrePlay = play;
 }
예제 #6
0
 public async Task DeleteAsync(TheatrePlay entity)
 {
     m_dataContext.TheatrePlays.Remove(entity);
     await m_dataContext.SaveChangesAsync();
 }
예제 #7
0
        public async Task CreateAsync(TheatrePlay entity)
        {
            await m_dataContext.TheatrePlays.AddAsync(entity);

            await m_dataContext.SaveChangesAsync();
        }