public ActionResult Create() { var model = new EmployeeViewModel(); model.offices = new SelectList(_OfficeService.GetAll(), "Id", "OfficeCode"); model.jobtitles = new SelectList(_JobTitleService.GetAll(), "Id", "JobTitle1"); model.employees = new SelectList(_EmployeeService.GetAll(), "Id", "Firstname"); return(View(model)); }
public ActionResult EditProfile(string Id, string temp) { if (Session["uname"] != null) { TempData["EditEmployeeId"] = Id; if (temp == "1") { ViewBag.Edit = "Yes"; } Employee employee = employeeRepository.Get(Id); OfficeService officeRepository = new OfficeService(); List <SelectListItem> officeList = new List <SelectListItem>(); SelectListItem init = new SelectListItem(); init.Text = "Please Select an Option"; init.Value = ""; officeList.Add(init); foreach (Office office in officeRepository.GetAll()) { SelectListItem option = new SelectListItem(); option.Text = office.OfficeId; option.Value = office.OfficeId; officeList.Add(option); } ViewBag.Offices = officeList; return(View(employee)); } return(RedirectToAction("Index", "Home")); }
public ActionResult Registration(string id) { if (Session["uname"] != null) { if (id == "1") { ViewBag.Reg = "Yes"; } OfficeService officeRepository = new OfficeService(); List <SelectListItem> officeList = new List <SelectListItem>(); SelectListItem init = new SelectListItem(); init.Text = "Please Select an Option"; init.Value = ""; officeList.Add(init); foreach (Office office in officeRepository.GetAll()) { SelectListItem option = new SelectListItem(); option.Text = office.OfficeId; option.Value = office.OfficeId; officeList.Add(option); } ViewBag.Offices = officeList; return(View()); } return(RedirectToAction("Index", "Home")); }
void loadData() { OfficeService officeService = new OfficeService(new CoffeShopContext()); gridControl1.DataSource = officeService.GetAll(); btnDelete.Enabled = false; }
public ActionResult Index() { OfficeService service = new OfficeService(); var list = service.GetAll(); OfficeModel model = new OfficeModel(); model.ListOffice = list; return(View(model)); }
public ActionResult Index(string Keywords, string sortOrder, int?page) { ViewBag.CurrentSort = sortOrder; ViewBag.CurrentFilter = Keywords; ViewBag.OfficeCodeSortParm = String.IsNullOrEmpty(sortOrder) ? "OfficeCode_desc" : ""; ViewBag.StateSortParm = sortOrder == "State" ? "State_desc" : "State"; ViewBag.CitySortParm = sortOrder == "City" ? "City_desc" : "City"; ViewBag.CountrySortParm = sortOrder == "Country" ? "Country_desc" : "Country"; var offices = _OfficeService.GetAll(); switch (sortOrder) { case "OfficeCode_desc": offices = offices.OrderByDescending(s => s.OfficeCode); break; case "State": offices = offices.OrderBy(s => s.State); break; case "City": offices = offices.OrderBy(s => s.City); break; case "Country": offices = offices.OrderBy(s => s.Country); break; default: offices = offices.OrderBy(s => s.OfficeCode); break; } if (!string.IsNullOrWhiteSpace(Keywords)) { offices = offices.Where(ofc => ofc.Country1.Name.Contains(Keywords)); } int pageSize = 4; int pageNumber = (page ?? 1); return(View(offices.ToPagedList(pageNumber, pageSize))); }
public ActionResult AssignTripDestination() { List <SelectListItem> OfficeList = new List <SelectListItem>(); foreach (Office office in officeService.GetAll()) { SelectListItem option = new SelectListItem(); option.Text = office.OfficeId; option.Value = office.OfficeId; OfficeList.Add(option); } ViewBag.OfficeList = OfficeList; return(View()); }
public ActionResult Edit(int ID) { AccountService service = new AccountService(); OfficeService service1 = new OfficeService(); RolService role = new RolService(); var account = service.Getbykey(ID); List <Office> list = service1.GetAll().ToList(); SelectList officelist = new SelectList(list, "OfficeID", "OfficeName"); ViewBag.OfficeList = officelist; List <Rol> listrole = role.GetAll().ToList(); SelectList rolelist = new SelectList(listrole, "RoleID", "Role_Name"); ViewBag.RoleList = rolelist; return(View(account)); }
public ActionResult EditEmployee(string id) { Employee emp = employeeService.Get(id); OfficeService officeRepository = new OfficeService(); List <SelectListItem> officeList = new List <SelectListItem>(); foreach (Office office in officeRepository.GetAll()) { SelectListItem option = new SelectListItem(); option.Text = office.OfficeId; option.Value = office.OfficeId; officeList.Add(option); } ViewBag.Offices = officeList; return(View(emp)); }
public ActionResult AddNewVehicle() { if (Session["uname"] != null) { List <SelectListItem> OfficeList = new List <SelectListItem>(); foreach (Office office in officeService.GetAll()) { SelectListItem option = new SelectListItem(); option.Text = office.OfficeId; option.Value = office.OfficeId; OfficeList.Add(option); } ViewBag.OfficeList = OfficeList; return(View()); } return(RedirectToAction("Index", "Home")); }
public ActionResult CreateAccount() { OfficeService service1 = new OfficeService(); RolService role = new RolService(); var account = new Account(); account.DateOfBirth = DateTime.Now; List <Office> list = service1.GetAll().ToList(); SelectList officelist = new SelectList(list, "OfficeID", "OfficeName"); ViewBag.OfficeList = officelist; List <Rol> listrole = role.GetAll().ToList(); SelectList rolelist = new SelectList(listrole, "RoleID", "Role_Name"); ViewBag.RoleList = rolelist; return(View(account)); }
public ActionResult EditEmployee(string id) { if (Session["uname"] != null) { Employee emp = employeeService.Get(id); OfficeService officeRepository = new OfficeService(); List <SelectListItem> officeList = new List <SelectListItem>(); foreach (Office office in officeRepository.GetAll()) { SelectListItem option = new SelectListItem(); option.Text = office.OfficeId; option.Value = office.OfficeId; officeList.Add(option); } ViewBag.Offices = officeList; return(View(emp)); } return(RedirectToAction("Index", "Home")); }
public IHttpActionResult Get() { List <Office> officeList = officeService.GetAll(); return(Ok(officeList)); }