public HttpResponseMessage GetPlantList() { List <ENT.PlantMasterSUB> lstResult = new List <ENT.PlantMasterSUB>(); try { if (User.IsInRole("Administrator")) { lstResult = new BAL.PlantMasterBAL().GetPlantList(); } else if (User.IsInRole("Admin")) { lstResult = new BAL.PlantMasterBAL().GetPlantListByUser(User.GetLogged_Userid()); } else { using (BAL.PlantMasterBAL obj = new Josheph.Framework.BusinessLayer.PlantMasterBAL()) { obj.Entity = new Josheph.Framework.Entity.PlantMasterSUB(); obj.Entity.AspNetUserID = User.GetLogged_Userid(); obj.Entity = (ENT.PlantMasterSUB)obj.GetByLoginID(obj.Entity); lstResult.Add(obj.Entity); } } } catch (Exception ex) { return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { lstResult })); } return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { lstResult })); }
public ActionResult Index() { ViewBag.PlantMaster = new BAL.PlantMasterBAL().GetAll(string.Empty, 1, 0); using (BAL.PlantMasterBAL obj = new Josheph.Framework.BusinessLayer.PlantMasterBAL()) { obj.Entity = new Josheph.Framework.Entity.PlantMasterSUB(); obj.Entity.AspNetUserID = User.GetLogged_Userid(); obj.Entity = (ENT.PlantMasterSUB)obj.GetByLoginID(obj.Entity); if (obj.Entity != null) { ViewBag.PlantName = obj.Entity.PlantName; } } return(View()); }