fork download
  1. using System.Linq;
  2. using System.Web.Mvc;
  3. using Scheduling.Domain.Abstact;
  4. using Scheduling.Domain.Entities;
  5. using Scheduling.WebUI.Models;
  6.  
  7. namespace Scheduling.WebUI.Controllers
  8. {
  9. public class EmployeesController : Controller
  10. {
  11. private IAccountingService service;
  12. public int pageSize = 10;
  13.  
  14. public EmployeesController(IAccountingService srvc)
  15. {
  16. service = srvc;
  17. }
  18.  
  19. public ViewResult List(int page = 1)
  20. {
  21. ViewBag.Counter = (page - 1) * pageSize + 1;
  22. EmployeeListViewModel model = new EmployeeListViewModel()
  23. {
  24. Employees = service.SelectEmployees(1, 3)
  25. .OrderBy(e => e.Id)
  26. .Skip((page - 1) * pageSize)
  27. .Take(pageSize),
  28.  
  29. PagingInfo = new PagingInfo
  30. {
  31. CurrentPage = page,
  32. ItemsPerPage = pageSize,
  33. TotalItems = service.EmployeesCount(1, 3)
  34. }
  35. };
  36.  
  37.  
  38. return View(model);
  39. }
  40.  
  41. public ViewResult Edit(int id)
  42. {
  43. Employee emp = service.GetEmployee(id);
  44.  
  45. return View(emp);
  46. }
  47.  
  48. [HttpPost]
  49. public ActionResult Edit(Employee emp)
  50. {
  51. if (ModelState.IsValid)
  52. {
  53. service.SaveEmployee(emp);
  54. return RedirectToAction("List");
  55. }
  56.  
  57. return View(emp);
  58. }
  59.  
  60. [HttpPost]
  61. public RedirectToRouteResult Delete(int id)
  62. {
  63. service.DeleteEmployee(id);
  64. return RedirectToAction("List");
  65. }
  66.  
  67.  
  68. public ViewResult Create()
  69. {
  70. return View("Edit", new Employee());
  71. }
  72.  
  73.  
  74.  
  75. }
  76. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(2,18): error CS0234: The type or namespace name `Mvc' does not exist in the namespace `System.Web'. Are you missing an assembly reference?
prog.cs(3,18): error CS0234: The type or namespace name `Domain' does not exist in the namespace `Scheduling'. Are you missing an assembly reference?
prog.cs(4,18): error CS0234: The type or namespace name `Domain' does not exist in the namespace `Scheduling'. Are you missing an assembly reference?
prog.cs(5,24): error CS0234: The type or namespace name `Models' does not exist in the namespace `Scheduling.WebUI'. Are you missing an assembly reference?
prog.cs(9,40): error CS0246: The type or namespace name `Controller' could not be found. Are you missing an assembly reference?
prog.cs(11,17): error CS0246: The type or namespace name `IAccountingService' could not be found. Are you missing an assembly reference?
prog.cs(14,36): error CS0246: The type or namespace name `IAccountingService' could not be found. Are you missing an assembly reference?
prog.cs(19,16): error CS0246: The type or namespace name `ViewResult' could not be found. Are you missing an assembly reference?
prog.cs(41,16): error CS0246: The type or namespace name `ViewResult' could not be found. Are you missing an assembly reference?
prog.cs(49,16): error CS0246: The type or namespace name `ActionResult' could not be found. Are you missing an assembly reference?
prog.cs(61,16): error CS0246: The type or namespace name `RedirectToRouteResult' could not be found. Are you missing an assembly reference?
prog.cs(68,16): error CS0246: The type or namespace name `ViewResult' could not be found. Are you missing an assembly reference?
Compilation failed: 12 error(s), 0 warnings
stdout
Standard output is empty