public async Task CanInsertAnnouncements() { var announcement = new Announcement() { PatrolId = 1, AnnouncementMarkdown = "Hello world", CreatedAt = DateTime.Now, CreatedByUserId = 1, PostAt = DateTime.Now, Subject = "Test" }; await _announcementRepository.InsertAnnouncement(announcement); Assert.NotZero(announcement.Id); }
public ActionResult Create(FormCollection collection) { try { AnnouncementModel announcementModel = new AnnouncementModel(); UpdateModel(announcementModel); if (User.Identity.IsAuthenticated) { announcementModel.Title = User.Identity.Name + ":" + announcementModel.Title; announcementModel.Tags = announcementModel.Tags + "," + User.Identity.Name; } announcementRepository.InsertAnnouncement(announcementModel); return(RedirectToAction("Index")); } catch { return(View("CreateAnnouncement")); } }