Glimpse没有显示更新sql语句

时间:2015-08-28 20:35:09

标签: asp.net-mvc-5 glimpse

为了调试我的MVC应用程序,我安装了Glimpse(Glimpse.Ado,Glimpse.AspNet,Glimpse.Core,Glimpse.EF6,Glimpse.Mvc5)。 SQL选项卡可方便地显示select语句,但不显示更新。我做错了什么?

我正在尝试查看实体框架对以下代码执行的操作:

    [HttpPost]
    [ValidateAntiForgeryToken]
    //public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Gender,Salary,DepartmentId")] Employee employee)
    public ActionResult Edit(EmployeeViewModel employeeViewModel)
    {
        try
        {
            if (ModelState.IsValid)
            {
                //db.Entry(employee).State = EntityState.Modified;
                var employee = db.Employees.Find(employeeViewModel.Id);
                employee.FirstName = employeeViewModel.FirstName;
                employee.LastName = employeeViewModel.LastName;
                employee.Gender = employeeViewModel.Gender;
                employee.Salary = Convert.ToInt32(employeeViewModel.Salary);
                employee.DepartmentId = employeeViewModel.DepartmentId;

                db.SaveChanges();
                return RedirectToAction("Index");
            }
        }
        catch(Exception ex)
        {
            ModelState.AddModelError("Salary", "Failed to save employee data: " + ex.Message);
        }
        ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "Name", employeeViewModel.DepartmentId);
        return View(employeeViewModel);
    }

但当然我的问题不是这个代码,而是关于Glimpse。 感谢。

0 个答案:

没有答案