Click here to Skip to main content
16,004,653 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
When the line db.savechanges() hits the breakpoint. Nothing happens. no errors in the catch block. The browser just freezes and data is not saved. I am using oracle with asp.net mvc.

I get no response from the browser or VS 15. All i get is the loading sign in the browser tab. i left it for 10 mins. what else do u want to know? i have cleared my cache before running this. _userService.Add(model); This line works perfectly but the latter "_userService.AddUserPermission(permission);" does not work

What I have tried:

C#
public ResponseResult AddUserPermission(USER_PERMISSION permission)
{
    try
    {

        _db.Entry(permission).State = EntityState.Modified;
        _db.SaveChanges();
        return new ResponseResult();
    }
    catch (Exception ex)
    {
        //return new ResponseResult();
        return new ResponseResult(ResutlType.Error, ex.Message);
    }


}
[HttpPost]
[CustomAuthorize("Admin")]
public ActionResult Create(USER model)
{
    try
    {

        string moduleId = Request.Form["ModuleId"];
        string isSelected = Request.Form["IsSelected"];

        model.DATE_CREATED = DateTime.Now;
        model.DATE_UPDATED = DateTime.Now;
        model.STATUS = (int)Status.Active;

        var userPermission = processPermissionData(moduleId, isSelected);
        //userPermission contains a list of permissions which i am trying to save
        _userService.Add(model);

        foreach (var permission in userPermission)
        {
            _userService.AddUserPermission(permission);
        }

        return RedirectToAction("Index");
    }
    catch
    {
        return View();
    }
}
Posted
Updated 23-Mar-17 23:51pm
Comments
Richard Deeming 22-Mar-17 16:49pm    
This may seem like a daft question, but have you actually stepped over the line in the debugger? Or have you just hit the breakpoint and stopped?

1 solution

You may have a lot of break points in your project. Just remove all break points from visual studio and leave a single break point where you want to see the changes or data.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900