-1

I have a method in Api as follows

[HttpPut]
        [Route("UpdateTeacher")]
        public IHttpActionResult UpdateTeacher(BusinessLayerTeacher Obj)
        {
            try
            {
                BusinessLayerTeacher obj = new BusinessLayerTeacher ();
                string status = BusinessLayerObject.UpdateTeacher(TeacherObj);
                return Ok(status);
            }
            catch
            {
                return NotFound();
            }
        }

Now in post man i am sending the put request to update the teacher object. It is not triggering this updateTeacher() method.

roopteja
  • 721
  • 2
  • 16
  • 36

1 Answers1

0

You are instantiating a new BusinessLayerTeacher object inside the method, which looks suspect when you are already passing in BusinessLayerTeacher as a parameter.

Maybe the route mapping isn't working because you're not passing in the right data in the request body.

Maybe you should be using TeacherObj as the parameter type?

Have a review and give that a try, good luck :-)