public MeetingComment AddComment(MemberId authorId, string comment, MeetingGroup meetingGroup, MeetingCommentingConfiguration meetingCommentingConfiguration) => MeetingComment.Create( this.Id, authorId, comment, meetingGroup, meetingCommentingConfiguration);
public async Task <IActionResult> CommentAdd(MeetingComment model /*, ICollection<IFormFile> files*/) { if (ModelState.IsValid) { Meetings meeting = _context.Meetings.Include(i => i.Committee).Single(i => i.MeetingID == model.MeetingID); if (meeting.Files == null) { model.Files = new List <FileBase>(); } model.ProfessorName = "DMS_Admin"; model.DateStamp = DateTime.Now; _context.MeetComments.Add(model); await _context.SaveChangesAsync(); return(RedirectToAction("ViewMeeting", new { comID = meeting.CommitteeID, mtnID = meeting.MeetingID })); } return(View(model)); }
public async Task AddAsync(MeetingComment meetingComment) { await _meetingsContext.MeetingComments.AddAsync(meetingComment); }
public MeetingComment AddComment(MemberId authorId, string comment) { this.CheckRule(new CommentCanBeAddedOnlyByAttendeeRule(authorId, _attendees)); return(MeetingComment.Create(this.Id, authorId, comment)); }
public async Task <IActionResult> FileAdd(MeetingComment model, ICollection <IFormFile> files) { if (ModelState.IsValid) { Meetings meeting = _context.Meetings.Include(i => i.Committee).Single(i => i.MeetingID == model.MeetingID); if (files == null) { return(RedirectToAction("ViewMeeting", new { comID = meeting.CommitteeID, mtnID = meeting.MeetingID })); } if (meeting.Files == null) { meeting.Files = new List <FileBase>(); } var uploads = Path.Combine(_environment.WebRootPath, "uploads/Committees"); foreach (var file in files) { if (file.Length > 0) { string name = file.FileName; MD5 hasher = MD5.Create(); DateTime now = new DateTime(); now = DateTime.Now; string fileName = GetMd5Hash(hasher, now.ToString()) + Path.GetExtension(file.FileName); using (var fileStream = new FileStream(Path.Combine(uploads, fileName), FileMode.Create)) { await file.CopyToAsync(fileStream); } if (model.Private == true) { FileBase fileToSave = new FileBase() { Location = "/uploads/Committees/" + fileName, Owned = Ownership.meetingPriv, OwnerID = model.ProfessorID, Added = DateTime.Now, ViewTitle = name, }; meeting.Files.Add(fileToSave); } else { FileBase fileToSave = new FileBase() { Location = "/uploads/Committees/" + fileName, Owned = Ownership.meetingPub, OwnerID = model.ProfessorID, Added = DateTime.Now, ViewTitle = name, }; meeting.Files.Add(fileToSave); } } await _context.SaveChangesAsync(); return(RedirectToAction("ViewMeeting", new { comID = meeting.CommitteeID, mtnID = meeting.MeetingID })); } return(View(model)); } return(RedirectToAction("ProfessorIndex")); }