Пример #1
0
        public ActionResult AddProfessor(string RowKey, string Name, string Lastname)
        {
            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();

            Professor professor = new Professor(RowKey)
            {
                Name = Name, Surname = Lastname
            };

            if (!proxy.ExistsProfessor(professor))
            {
                proxy1.AddProfessor(professor);
                proxy2.LoggerProfessor("Upisano u Table", RowKey, Name, Lastname);

                // proxy2.Download(RowKey + Name);

                return(RedirectToAction("Index", "Subject"));
            }


            return(RedirectToAction("AddProfessor", "Subject"));
        }