Exemplo n.º 1
0
        public void AddPresentation(PresentationDTO presentationDTO)
        {
            var presentation = MapperExtension.mapper.Map <PresentationDTO, Presentation>(presentationDTO);

            _db.Presentations.Add(presentation);
            _db.SaveChanges();
        }
Exemplo n.º 2
0
        public void EditPresentation(PresentationDTO presentationDTO)
        {
            var presentation = MapperExtension.mapper.Map <PresentationDTO, Presentation>(presentationDTO);

            _db.Entry(_db.Presentations.Find(presentationDTO.PresentationId)).CurrentValues.SetValues(presentation);
            _db.SaveChanges();
        }
Exemplo n.º 3
0
        public async Task <IActionResult> postPresentation(PresentationDTO input)
        {
            var user = await userManager.FindByIdAsync(input.userID);

            if (input.newPresentation)
            {
                if (user.Presentations == null)
                {
                    user.Presentations = new List <Presentation>();
                }
                user.Presentations.Add(new Presentation
                {
                    Title     = input.title,
                    Paragraph = input.Paragraph,
                    id        = input.id
                });
            }
            else
            {
                for (int i = 0; i < user.Presentations.Count; i++)
                {
                }
            }
            await userManager.UpdateAsync(user);

            return(Ok(user.Presentations));
        }
Exemplo n.º 4
0
        public async Task <bool> EditPresentationAsync(PresentationDTO presentation)
        {
            var path   = Properties.Resources.editPresentationPath;
            var result = await _apiHelper.Put(path, presentation);

            return(result != null && result.ResponseType == ResponseType.Success);
        }
 public PresentationDetailsReadOnly(PresentationDTO presentation)
 {
     InitializeComponent();
     WindowHelper.SmallWindowSettings(this);
     authCore          = new AuthenticationCore();
     articleCore       = new ArticleCore();
     sessionCore       = new SessionCore();
     this.presentation = presentation;
     FillPresentationBoxes();
 }
Exemplo n.º 6
0
        public IActionResult Post(int id, [FromBody] PresentationDTO presentation)
        {
            if (presentation == null)
            {
                throw new Exception("Could not find presentation with id " + id);
            }

            //Wendy - NEED TO MAKE SURE Admins can add new rooms
            _presentServ.UpdatePresentation(id, presentation);

            return(Ok());
        }
Exemplo n.º 7
0
 public bool EditPresentation(PresentationDTO presentation)
 {
     try
     {
         _repository.EditPresentation(presentation);
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 8
0
 public IHttpActionResult EditPresentation([FromBody] PresentationDTO presentation)
 {
     if (string.IsNullOrEmpty(presentation.Title))
     {
         return(BadRequest());
     }
     if (_bll.EditPresentation(presentation))
     {
         return(Ok());
     }
     return(InternalServerError());
 }
        // This is an Edit of a specific presentation
        public void UpdatePresentation(int presentationId, PresentationDTO presentation)
        {
            var editedPresentation = _presentRepo.GetById(presentationId).FirstOrDefault();

            if (editedPresentation == null)
            {
                throw new Exception("Could not find presentation with id " + presentationId);
            }
            editedPresentation.Title        = presentation.Title;
            editedPresentation.ConferenceId = presentation.ConferenceId;
            editedPresentation.Description  = presentation.Description;
            editedPresentation.ImageUrl     = presentation.ImageUrl;

            _presentRepo.SaveChanges();
        }
Exemplo n.º 10
0
        public async Task <IActionResult> removePresentation(PresentationDTO input)
        {
            var user = await userManager.FindByIdAsync(input.userID);

            for (int i = 0; i < user.Presentations.Count; i++)
            {
                if (user.Presentations[i].id == input.id)
                {
                    user.Presentations.RemoveAt(i);
                    await userManager.UpdateAsync(user);

                    return(Ok(user.Presentations));
                }
            }
            return(BadRequest());
        }
Exemplo n.º 11
0
        public async Task <IActionResult> updatePresentation(PresentationDTO input)
        {
            var user = await userManager.FindByIdAsync(input.userID);

            for (int i = 0; i < user.Presentations.Count; i++)
            {
                if (user.Presentations[i].id == input.id)
                {
                    user.Presentations[i].Title     = input.title;
                    user.Presentations[i].Paragraph = input.Paragraph;
                    await userManager.UpdateAsync(user);

                    return(Ok(user.Presentations));
                }
            }
            return(BadRequest());
        }
Exemplo n.º 12
0
 public bool AcceptArticle(int articleId, int editorId)
 {
     try
     {
         var article = _repository.GetArticleById(articleId);
         article.Status         = "accepted";
         article.AcceptanceDate = DateTime.Now;
         var authors      = _repository.GetAuthorsFromArticleId(articleId);
         var presentation = new PresentationDTO()
         {
             PresenterId      = authors.First().AccountId,
             Title            = article.Topic,
             ArticleId        = article.ArticleId,
             SpecialSessionId = article.SpecialSessionId
         };
         _presentationRepository.AddPresentation(presentation);
         var presentationId = (int)_presentationRepository.GetLastPresentationId();
         article.PresentationId = presentationId;
         _repository.EditArticle(article);
         foreach (var author in authors)
         {
             var message = new MessageDTO()
             {
                 SenderId   = editorId,
                 ReceiverId = author.AccountId,
                 Date       = DateTime.Now,
                 Content    = $"Your article {article.Topic} has been accepted"
             };
             if (message.SenderId != message.ReceiverId)
             {
                 _messageRepository.AddMessage(message);
             }
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }