public void DeleteTest() { AgileWorksWebAppealsDBEntities agileWorksWebAppealsDBEntities = new AgileWorksWebAppealsDBEntities(); Appeals appeals = new Appeals(); appeals.deadlineDatetime = new DateTime(2019, 1, 19); appeals.entryDatetime = DateTime.Now; appeals.description = "Test123456Delete"; AppealsController appealsController = new AppealsController(); agileWorksWebAppealsDBEntities.Appeals.Add(appeals); agileWorksWebAppealsDBEntities.SaveChanges(); var ifExists = agileWorksWebAppealsDBEntities.Appeals.Where(x => x.appealId == appeals.appealId).FirstOrDefault(); Assert.IsNotNull(ifExists); var result2 = appealsController.Delete(ifExists.appealId, new FormCollection()); var isDeleted = agileWorksWebAppealsDBEntities.Appeals.Where(x => x.appealId == ifExists.appealId).FirstOrDefault(); Assert.IsNull(isDeleted); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); IAppeal laheKoht = new Appeal() { kirjeldus = "Lahe Leht", lahendamiseT2htAeg = DateTime.Parse("10.07.2017 14:40:59") }; Appeals.AadAppeal(laheKoht); IAppeal p88rdumine = new Appeal() { kirjeldus = "Uus pöördumine", lahendamiseT2htAeg = DateTime.Parse("5.06.2017 18:38:32") }; Appeals.AadAppeal(p88rdumine); IAppeal aegumata = new Appeal() { kirjeldus = "Aegumata", lahendamiseT2htAeg = DateTime.Parse("5.06.2018 18:38:32") }; Appeals.AadAppeal(aegumata); }
public ActionResult Appeal(Appeal model) { if (ModelState.IsValid) { Appeals.AadAppeal(model); return(View("ThanksForInserting")); } return(View(model)); }
public void IndexTest() { Appeals appeals = new Appeals(); AppealsController appealsController = new AppealsController(); ViewResult viewResult = appealsController.Index(5) as ViewResult; Assert.IsNotNull(viewResult.Model); Assert.IsInstanceOfType(viewResult.Model, typeof(PagedList.PagedList <Appeals>)); }
private void FillAppeals() { if (File.Exists(_pathToZipAppeals)) { Appeals.Clear(); Thread myThread = new Thread(new ThreadStart(FillAppeal)); myThread.Start(); } }
private void FileReader_onWrite() { foreach (var appeal in appeals) { App.Current.Dispatcher.BeginInvoke((Action) delegate // <--- HERE { Appeals.Add(new FillAppeal_VM { FullName = appeal[0], InputPhone = appeal[1], CurrentDay = appeal[2], CurrentHour = Convert.ToInt32(appeal[3]), CurrentMinute = appeal[4], Status = appeal[5], ParticipantRole = appeal[6], Email = appeal[7], Company = appeal[8], Appeal = appeal[9], AdditionalInfo = appeal[10], UserName = appeal[11] }); }); } }
public void TestIfPastAppealCanBeAdded() { AgileWorksWebAppealsDBEntities agileWorksWebAppealsDBEntities = new AgileWorksWebAppealsDBEntities(); Appeals appeals = new Appeals(); appeals.deadlineDatetime = new DateTime(1996, 1, 19); appeals.entryDatetime = DateTime.Now; appeals.description = "Test123456123456789"; AppealsController appealsController = new AppealsController(); var result = appealsController.Create(appeals); }
// GET: Appeals/Delete/5 public ActionResult Delete(int id) { using (AgileWorksWebAppealsDBEntities agileWorksDatabaseEntities = new AgileWorksWebAppealsDBEntities()) { Appeals appeals = agileWorksDatabaseEntities.Appeals.Where(x => x.appealId == id).First(); if (appeals != null) { return(View(appeals)); } else { return(new HttpNotFoundResult("Appeal not found!")); } } }
public void TestIfFutureAppealExists() { AgileWorksWebAppealsDBEntities agileWorksWebAppealsDBEntities = new AgileWorksWebAppealsDBEntities(); Appeals appeals = new Appeals(); appeals.deadlineDatetime = new DateTime(2020, 1, 19); appeals.entryDatetime = DateTime.Now; appeals.description = "Test123456123456789"; AppealsController appealsController = new AppealsController(); var result = appealsController.Create(appeals); var ifExists = agileWorksWebAppealsDBEntities.Appeals.Where(x => x.appealId == appeals.appealId).FirstOrDefault(); Assert.IsNotNull(ifExists); Assert.AreEqual(appeals.description, ifExists.description); }
public ActionResult Delete(int id, FormCollection collection) { using (AgileWorksWebAppealsDBEntities agileWorksDatabaseEntities = new AgileWorksWebAppealsDBEntities()) { Appeals appeal = agileWorksDatabaseEntities.Appeals.Where(x => x.appealId == id).FirstOrDefault(); if (appeal != null) { agileWorksDatabaseEntities.Appeals.Remove(appeal); agileWorksDatabaseEntities.SaveChanges(); } else { return(new HttpNotFoundResult("Appeal not found!")); } } return(RedirectToAction("Index")); }
public ActionResult Create(Appeals appeals) { var now = DateTime.Now; using (AgileWorksWebAppealsDBEntities agileWorksDatabaseEntities = new AgileWorksWebAppealsDBEntities()) { if (ModelState.IsValid) { agileWorksDatabaseEntities.Appeals.Add(appeals); agileWorksDatabaseEntities.SaveChanges(); } else if (!ModelState.IsValid) { return(View(appeals)); } } return(RedirectToAction("Index")); }
public ActionResult EndAppeal(int id) { Appeals.EndAppeal(id); return(View("ShowAppeals", Appeals.GetActiveAppeals())); }
public ActionResult ShowAppeals() { List <IAppeal> appeals = Appeals.GetActiveAppeals(); return(View(appeals)); }