search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How can I make a filter per user?

Asked by Cristhian Sandoval
4 years ago.

I am currently reading a single table with all the events of all users. But now I need to send the id of the current user in the url so that it reaches the controller and can only show the events of this user.

Thanks for the help I am currently able to send the user id of the view to the controller but when I get to the Dpc class that inherits from DayPilotCalendar

Answer posted by Dan Letecky [DayPilot]
4 years ago.

You can add a custom constructor that will accept additional parameters:

Action:
public ActionResult Backend()
{
  var userId = ....
  return new Dpc(userId).CallBack(this);
}

Dpc class:

public class Dpc : DayPilotCalendar
{
  string userId;

  Dpc(string userId) {
    this.userId = userId;
  }

  // ...
}

You can also set the property value directly.

Another option is to access the controller class using "Controller" property of DayPilotCalendar.

Comment posted by Cristhian Sandoval
4 years ago.

I have included the code you passed me and well I get a message that says the following:
'BackendController.Dpc.Dpc (int)' is not accessible due to its level of protection

How can i fix this?

public class BackendController : Controller
    {
        public ActionResult Day(int idEmpleado)
        {
          
           return new Dpc(idEmpleado).CallBack(this);
        }
    }

class Dpc : DayPilotCalendar
        {
            int userId;
            Dpc(int userId)
            {
                this.userId = userId;
            }
        }
Answer posted by Cristhian Sandoval
4 years ago.

I solved it, it was because I did not put the builder was public. Thank you very much and this question is resolved.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.