public ActionResult Edit(string id) { ViewData["EmployeeRanks"] = Utilities.GetEmployeeRankNameList(); if (Session["ClientId"] != null) { ViewData["Branchs"] = Utilities.GetBranchNameList((int)Session["ClientId"]); ViewData["Zones"] = Utilities.GetZoneNameList((int)Session["ClientId"]); if (Session["ZoneId"] != null) { ViewData["Regions"] = Utilities.GetRegionNameList((int)Session["ClientId"], (int)Session["ZoneId"]); } else { ViewData["Regions"] = Utilities.GetRegionNameList((int)Session["ClientId"], null); } ViewData.Model = EmployeeModels.GetEmployeeById(id); } else { if (Roles.IsUserInRole("SuperAdmin")) { return(RedirectToAction("List", "Client")); } } ViewData["Genders"] = Utilities.GetGenderNameList(); ViewData["MaritalStstus"] = Utilities.GetMaritalStatusList(); ViewData["Qualifications"] = Utilities.GetQualificationList(); ViewData["States"] = Utilities.GetStateList(Utilities.IndiaCountryCode); ViewData["Countries"] = Utilities.GetCountryList(); return(View()); }
public IHttpActionResult GetEmployeeById(int id) { RedisKey cacheKey = "employee_" + id; string cacheValue = RedisCacheHelper.GetValueByKey(cacheKey); if (cacheValue == null) { EmployeeModels employeeMode = new EmployeeModels(); try { var employee = employeeMode.GetEmployeeById(id); RedisCacheHelper.SetKeyValue(cacheKey, new JavaScriptSerializer().Serialize(employee)); return(Ok(employee)); } catch { return(NotFound()); } } else { return(Ok(new JavaScriptSerializer().Deserialize <Object>(cacheValue))); } }