public ActionResult ChangeCostCenter(string costcenterid) { try { using (var db = new BudgetContext()) { var costcenter = db.CostCenters.Where(c => c.CostCenterID == costcenterid).FirstOrDefault(); AuthManager.ChangeWorkingCostcenter(costcenter); // Save history to database CurrentWorkingCC current = new CurrentWorkingCC(); current.Id = Guid.NewGuid(); current.WorkingCostCenterID = costcenter.CostCenterID; current.EmployeeID = AuthManager.GetCurrentUser().EmployeeID; current.NewCreateTimeStamp(); db.CurrentWorkingCCs.Add(current); db.SaveChanges(); returnobj.SetSuccess(AuthManager.GetAuthentication()); } } catch (Exception ex) { returnobj.SetError(ex.Message); } return(Content(returnobj.ToJson(), "application/json")); }