public ActionResult Edit(int id) { EmployeeModel model = new EmployeeModel(); model.ActionType = "Update"; model = EmployeeService.getEmployeebyId(id); var UserList = (from UserType e in Enum.GetValues(typeof(UserType)) select new { Id = (int)e, Name = CommanModel.GetEnumDisplayName(e) }); var wages = (from wagestype e in Enum.GetValues(typeof(wagestype)) select new { Id = (int)e, Name = e }); ViewBag.Userlist = new SelectList(UserList, "Id", "Name"); ViewBag.wageslist = new SelectList(wages, "Id", "Name"); return(View("Add", model)); }
public ActionResult Add() { EmployeeModel model = new EmployeeModel(); if (model.ActionType == "") { model.ActionType = "Register"; } var UserList = (from UserType e in Enum.GetValues(typeof(UserType)) select new { Id = (int)e, Name = CommanModel.GetEnumDisplayName(e) }); var wages = (from wagestype e in Enum.GetValues(typeof(wagestype)) select new { Id = (int)e, Name = e }); ViewBag.Userlist = new SelectList(UserList, "Id", "Name"); ViewBag.wageslist = new SelectList(wages, "Id", "Name"); return(View(model)); }