public ActionResult Add(ProjectEntryTable projectEntry) { var newEntry = projectEntry.CreateProjectEntryModel; newEntry.CreatedBy = projectEntry.EmployeeID; var result = _projectEntryHandler.HandlePostProjectEntry(newEntry); _projectEntryRepository.Dispose(); if (result) { return(RedirectToAction("Index", new { sortOrder = projectEntry.CurrentSort, currentFilter = projectEntry.CurrentFilter, searchString = projectEntry.CurrentFilter, page = projectEntry.Page, pageSize = projectEntry.PageSize, startDate = projectEntry.StartDate, endDate = projectEntry.EndDate, employeeID = projectEntry.EmployeeID })); } return(Redirect("~/Views/Error/BadRequest.cshtml")); }
public MyActivityController() { _Context = new SREDContext(); _projectEntryRepository = new ProjectEntryRepository(_Context); _projectEntryHandler = new ProjectEntryHandler(_Context, _projectEntryRepository); _projectEntryTableModel = new ProjectEntryTable(); _hours = new Hours(); }
public void ShouldCreateInstance_WhenProvidedAllParameters() { var sortOrder = "project"; var pageSize = 2; var result = new ProjectEntryTable(sortOrder, pageSize); Assert.That(result.CurrentSort, Is.EqualTo(sortOrder)); Assert.That(result.PageSize, Is.EqualTo(pageSize)); }
public ActionResult Delete(ProjectEntryTable deleteEntry) { var result = _projectEntryHandler.handleDeleteProjectEntry(deleteEntry.DeleteEntryId); if (result) { return(RedirectToAction("Index", new { sortOrder = deleteEntry.CurrentSort, currentFilter = deleteEntry.CurrentFilter, searchString = deleteEntry.CurrentFilter, page = deleteEntry.Page, pageSize = deleteEntry.PageSize, startDate = deleteEntry.StartDate, endDate = deleteEntry.EndDate, employeeID = deleteEntry.EmployeeID })); } return(Redirect("~/Views/Error/BadRequest.cshtml")); }
public ActionResult Edit(ProjectEntryTable updatedEntry) { var entryToUpdate = updatedEntry.UpdatedProjectEntryModel; entryToUpdate.ModifiedBy = updatedEntry.EmployeeID; var result = _projectEntryHandler.HandlePatchProjectEntry(entryToUpdate); if (result) { return(RedirectToAction("Index", new { sortOrder = updatedEntry.CurrentSort, currentFilter = updatedEntry.CurrentFilter, searchString = updatedEntry.CurrentFilter, page = updatedEntry.Page, pageSize = updatedEntry.PageSize, startDate = updatedEntry.StartDate, endDate = updatedEntry.EndDate, employeeID = updatedEntry.EmployeeID, getPendingCategoryEntries = updatedEntry.PendingCategories })); } return(Redirect("~/Views/Error/BadRequest.cshtml")); }
public ProjectEntryTable HandleGetProjectEntry(IList <ProjectEntry> entries, string sortOrder, string currentFilter, string searchString, int?page, int?pageSize, DateTime startDate, DateTime endDate, Guid EmployeeID) { _projectEntryTable = new ProjectEntryTable(sortOrder, pageSize); _projectEntryTable.StartDate = startDate; _projectEntryTable.EndDate = endDate; _projectEntryTable.EmployeeID = EmployeeID; if (searchString != null) { page = 1; } else { searchString = currentFilter; } _projectEntryTable.CurrentFilter = searchString; var searchedEntries = SearchProjectEntries(searchString, entries); var sortedEntries = SortEntries(sortOrder, searchedEntries); _projectEntryTable.startString = startDate.ToString(@"MM\/dd\/yyyy"); _projectEntryTable.endString = endDate.ToString(@"MM\/dd\/yyyy"); var pageNumber = page ?? 1; _projectEntryTable.Entries = sortedEntries.ToPagedList(pageNumber, _projectEntryTable.PageSize); return(_projectEntryTable); }
public void ShouldCreateInstance_WhenAllParametersAreNull() { var result = new ProjectEntryTable(null, null); Assert.That(result, Is.Not.Null); }