public ActionResult AddLesson(string RowKey, string Title, DateTime PlannedDate, string Description) { NetTcpBinding binding = new NetTcpBinding(); ChannelFactory <IJobReader> factory = new ChannelFactory <IJobReader>(binding, new EndpointAddress("net.tcp://localhost:10101/InputRequest")); IJobReader proxy = factory.CreateChannel(); NetTcpBinding binding1 = new NetTcpBinding(); ChannelFactory <IJobWriter> factory1 = new ChannelFactory <IJobWriter>(binding, new EndpointAddress("net.tcp://localhost:10100/InputRequest")); IJobWriter proxy1 = factory1.CreateChannel(); NetTcpBinding binding2 = new NetTcpBinding(); ChannelFactory <IJobLogger> factory2 = new ChannelFactory <IJobLogger>(binding, new EndpointAddress("net.tcp://localhost:10102/InputRequest")); IJobLogger proxy2 = factory2.CreateChannel(); Lesson l = new Lesson(RowKey) { Title = Title, PlannedDate = PlannedDate, Description = Description }; if (!proxy.ExistsLesson(l)) { proxy1.AddLesson(l); proxy2.LoggerLesson("Upisano u Table", RowKey, Title, PlannedDate, Description); return(RedirectToAction("Index", "Subject")); } return(RedirectToAction("AddLesson", "Subject")); }