public void AddPresentation(PresentationDTO presentationDTO) { var presentation = MapperExtension.mapper.Map <PresentationDTO, Presentation>(presentationDTO); _db.Presentations.Add(presentation); _db.SaveChanges(); }
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(); }
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)); }
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(); }
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()); }
public bool EditPresentation(PresentationDTO presentation) { try { _repository.EditPresentation(presentation); } catch { return(false); } return(true); }
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(); }
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()); }
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()); }
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); }