public ActionResult Delete([FromBody] Studententity StudentObject)
 {
     using (var _context = new StudentContext())
     {
         _context.TableStudent.Remove(StudentObject);
         _context.SaveChanges();
     }
     return(Ok("StudentDeleted"));
 }
 public Actioa Post([FromBody] Studententity StudentObject)
 {
     using (var _context = new StudentContext())
     {
         _context.TableStudent.Add(StudentObject);
         _context.SaveChanges();
     }
     return(Ok("student added"));
 }
Beispiel #3
0
        private static async Task AdaugareStudent()
        {
            System.Console.WriteLine("Introduceti Universitatea:");
            string university = Console.ReadLine();

            System.Console.WriteLine("Introduceti CNP:");
            string cnp = Console.ReadLine();

            System.Console.WriteLine("Intruduceti nume:");
            string nume = Console.ReadLine();

            System.Console.WriteLine("Introduceti prenume:");
            string prenume = Console.ReadLine();

            System.Console.WriteLine("Introduceti facultatea:");
            string facultate = Console.ReadLine();

            System.Console.WriteLine("Introduceti anul de studiu:");
            string an = Console.ReadLine();

            Studententity stud = await RetrieveRecordAsync(studentsTable, university, cnp);

            if (stud == null)
            {
                var student = new Studententity(university, cnp);
                student.Nume      = nume;
                student.Prenume   = prenume;
                student.Facultate = facultate;
                student.An        = Convert.ToInt32(an);
                //var insertOperation = TableOperation.Insert(student);
                //await studentsTable.ExecuteAsync(insertOperation);

                var         jsonStundet    = JsonConvert.SerializeObject(student);
                var         plainTextBytes = System.Text.Encoding.UTF8.GetBytes(jsonStundet);
                var         base64String   = System.Convert.ToBase64String(plainTextBytes);
                QueueClient queueClient    = new QueueClient("Trial period expired", "stundents-queue");
                await queueClient.SendMessageAsync(base64String);

                System.Console.WriteLine("Studentul a fost introdus!");
            }
            else
            {
                System.Console.WriteLine("Exista deja acest student!");
            }
        }
Beispiel #4
0
        private static async Task AdaugareStudent()
        {
            System.Console.WriteLine("Introduceti Universitatea:");
            string university = Console.ReadLine();

            System.Console.WriteLine("Introduceti CNP:");
            string cnp = Console.ReadLine();

            System.Console.WriteLine("Intruduceti nume:");
            string nume = Console.ReadLine();

            System.Console.WriteLine("Introduceti prenume:");
            string prenume = Console.ReadLine();

            System.Console.WriteLine("Introduceti facultatea:");
            string facultate = Console.ReadLine();

            System.Console.WriteLine("Introduceti anul de studiu:");
            string an = Console.ReadLine();

            Studententity stud = await RetrieveRecordAsync(studentsTable, university, cnp);

            if (stud == null)
            {
                var student = new Studententity(university, cnp);
                student.Nume      = nume;
                student.Prenume   = prenume;
                student.Facultate = facultate;
                student.An        = Convert.ToInt32(an);
                //var insertOperation = TableOperation.Insert(student);
                //await studentsTable.ExecuteAsync(insertOperation);

                var         jsonStundet    = JsonConvert.SerializeObject(student);
                var         plainTextBytes = System.Text.Encoding.UTF8.GetBytes(jsonStundet);
                var         base64String   = System.Convert.ToBase64String(plainTextBytes);
                QueueClient queueClient    = new QueueClient("DefaultEndpointsProtocol=https;AccountName=datc2020ciocan;AccountKey=fvasM+33dEPAmTthxdoD4PPbN1gPBMYmBa+umXvZuITyx/aawaORDg+jVYkzS0y9Z18gq1OMAUNobAaHJeamiA==;EndpointSuffix=core.windows.net", "stundents-queue");
                await queueClient.SendMessageAsync(base64String);

                System.Console.WriteLine("Studentul a fost introdus!");
            }
            else
            {
                System.Console.WriteLine("Exista deja acest student!");
            }
        }
Beispiel #5
0
        private static async Task AdaugareStudent()
        {
            System.Console.WriteLine("Introduceti Universitatea:");
            string university = Console.ReadLine();

            System.Console.WriteLine("Introduceti CNP:");
            string cnp = Console.ReadLine();

            System.Console.WriteLine("Intruduceti nume:");
            string nume = Console.ReadLine();

            System.Console.WriteLine("Introduceti prenume:");
            string prenume = Console.ReadLine();

            System.Console.WriteLine("Introduceti facultatea:");
            string facultate = Console.ReadLine();

            System.Console.WriteLine("Introduceti anul de studiu:");
            string an = Console.ReadLine();

            Studententity stud = await RetrieveRecordAsync(studentsTable, university, cnp);

            if (stud == null)
            {
                var student = new Studententity(university, cnp);
                student.Nume      = nume;
                student.Prenume   = prenume;
                student.Facultate = facultate;
                student.An        = Convert.ToInt32(an);
                //var insertOperation = TableOperation.Insert(student);
                //await studentsTable.ExecuteAsync(insertOperation);

                var         jsonStundet    = JsonConvert.SerializeObject(student);
                var         plainTextBytes = System.Text.Encoding.UTF8.GetBytes(jsonStundet);
                var         base64String   = System.Convert.ToBase64String(plainTextBytes);
                QueueClient queueClient    = new QueueClient("DefaultEndpointsProtocol=https;AccountName=datc2020calin;AccountKey=YE+mCp/GKqlbCgMWIiKYJrUxbhbU7UamgwC2lqCJKxHx6lRYPv5pIV05bWpYs4os5vYAv4T9SrhzVyGCJ86y7g==;EndpointSuffix=core.windows.net", "stundents-queue");
                await queueClient.SendMessageAsync(base64String);

                System.Console.WriteLine("Studentul a fost introdus!");
            }
            else
            {
                System.Console.WriteLine("Exista deja acest student!");
            }
        }
Beispiel #6
0
        private static async Task AddNewStudent()
        {
            System.Console.WriteLine("Adauga universitatea:");
            string university = Console.ReadLine();

            System.Console.WriteLine("Adauga CNP:");
            string cnp = Console.ReadLine();

            System.Console.WriteLine("Adauga nume:");
            string nume = Console.ReadLine();

            System.Console.WriteLine("Adauga prenume:");
            string prenume = Console.ReadLine();

            System.Console.WriteLine("Adauga facultate:");
            string facultate = Console.ReadLine();

            System.Console.WriteLine("Adauga an studiu:");
            string an = Console.ReadLine();

            Studententity stud = await RetrieveRecordAsync(studentsTable, university, cnp);

            if (stud == null)
            {
                var student = new Studententity(university, cnp);
                student.Nume      = nume;
                student.Prenume   = prenume;
                student.Facultate = facultate;
                student.An        = Convert.ToInt32(an);
                var insertOperation = TableOperation.Insert(student);
                await studentsTable.ExecuteAsync(insertOperation);

                System.Console.WriteLine("S-a adaugat!");
            }
            else
            {
                System.Console.WriteLine("S-a gasit!");
            }
        }
Beispiel #7
0
        private static async Task AdaugareStudent()
        {
            System.Console.WriteLine("Universitatea:");
            string universitate = Console.ReadLine();

            System.Console.WriteLine("CNP:");
            string cnp = Console.ReadLine();

            System.Console.WriteLine("Nume:");
            string nume = Console.ReadLine();

            System.Console.WriteLine("Prenume:");
            string prenume = Console.ReadLine();

            System.Console.WriteLine("Facultatea:");
            string facultate = Console.ReadLine();

            System.Console.WriteLine("Anul de studiu:");
            string an = Console.ReadLine();

            Studententity stud = await RetrieveRecordAsync(studentsTable, universitate, cnp);

            if (stud == null)
            {
                var student = new Studententity(universitate, cnp);
                student.Nume      = nume;
                student.Prenume   = prenume;
                student.Facultate = facultate;
                student.An        = Convert.ToInt32(an);
                var insertOperation = TableOperation.Insert(student);
                await studentsTable.ExecuteAsync(insertOperation);

                System.Console.WriteLine("Studentul a fost introdus!");
            }
            else
            {
                System.Console.WriteLine("Exista deja acest student!");
            }
        }
Beispiel #8
0
        private static async Task AddNewStudent()
        {
            System.Console.WriteLine("Insert universitate:");
            string universitate = Console.ReadLine();

            System.Console.WriteLine("Insert cnp:");
            string cnp = Console.ReadLine();

            System.Console.WriteLine("Insert nume:");
            string nume = Console.ReadLine();

            System.Console.WriteLine("Insert prenume:");
            string prenume = Console.ReadLine();

            System.Console.WriteLine("Insert facultate:");
            string facultate = Console.ReadLine();

            System.Console.WriteLine("Insert an studiu:");
            string an = Console.ReadLine();

            Studententity stud = await RetrieveRecordAsync(studentsTable, universitate, cnp);

            if (stud == null)
            {
                var student = new Studententity(universitate, cnp);
                student.Nume      = nume;
                student.Prenume   = prenume;
                student.Facultate = facultate;
                student.An        = Convert.ToInt32(an);
                var insertOperation = TableOperation.Insert(student);
                await studentsTable.ExecuteAsync(insertOperation);

                System.Console.WriteLine("Record inserted!");
            }
            else
            {
                System.Console.WriteLine("Record exists!");
            }
        }
Beispiel #9
0
        private static async Task DeleteStudent()
        {
            System.Console.WriteLine("Adauga universitatea:");
            string university = Console.ReadLine();

            System.Console.WriteLine("Adauga CNP:");
            string cnp = Console.ReadLine();

            Studententity stud = await RetrieveRecordAsync(studentsTable, university, cnp);

            if (stud != null)
            {
                var student = new Studententity(university, cnp);
                student.ETag = "*";
                var deleteOperation = TableOperation.Delete(student);
                await studentsTable.ExecuteAsync(deleteOperation);

                System.Console.WriteLine("S-a sters!");
            }
            else
            {
                System.Console.WriteLine("Studentul nu exista!");
            }
        }
Beispiel #10
0
        private static async Task EditStudent()
        {
            System.Console.WriteLine("Adauga universitatea:");
            string university = Console.ReadLine();

            System.Console.WriteLine("Adauga CNP:");
            string        cnp  = Console.ReadLine();
            Studententity stud = await RetrieveRecordAsync(studentsTable, university, cnp);

            if (stud != null)
            {
                System.Console.WriteLine("S-a gasit!");
                var student = new Studententity(university, cnp);
                System.Console.WriteLine("Adauga nume:");
                string nume = Console.ReadLine();
                System.Console.WriteLine("Adauga prenume:");
                string prenume = Console.ReadLine();
                System.Console.WriteLine("Adauga facultate:");
                string facultate = Console.ReadLine();
                System.Console.WriteLine("Adauga an studiu:");
                string an = Console.ReadLine();
                student.Nume      = nume;
                student.Prenume   = prenume;
                student.Facultate = facultate;
                student.An        = Convert.ToInt32(an);
                student.ETag      = "*";
                var updateOperation = TableOperation.Replace(student);
                await studentsTable.ExecuteAsync(updateOperation);

                System.Console.WriteLine("S-a modificat!");
            }
            else
            {
                System.Console.WriteLine("Nu s-a gasit studentul!");
            }
        }
Beispiel #11
0
        private static async Task DeleteStudent()
        {
            System.Console.WriteLine("Insert universitatea:");
            string universitatea = Console.ReadLine();

            System.Console.WriteLine("Insert cnp:");
            string cnp = Console.ReadLine();

            Studententity stud = await RetrieveRecordAsync(studentsTable, universitatea, cnp);

            if (stud != null)
            {
                var student = new Studententity(universitatea, cnp);
                student.ETag = "*";
                var deleteOperation = TableOperation.Delete(student);
                await studentsTable.ExecuteAsync(deleteOperation);

                System.Console.WriteLine("Record deleted!");
            }
            else
            {
                System.Console.WriteLine("Record does not exists!");
            }
        }
Beispiel #12
0
        private static async Task EditStudent()
        {
            System.Console.WriteLine("Insert universitate:");
            string universitate = Console.ReadLine();

            System.Console.WriteLine("Insert cnp:");
            string        cnp  = Console.ReadLine();
            Studententity stud = await RetrieveRecordAsync(studentsTable, universitate, cnp);

            if (stud != null)
            {
                System.Console.WriteLine("Record exists!");
                var student = new Studententity(universitate, cnp);
                System.Console.WriteLine("Insert Nume:");
                string nume = Console.ReadLine();
                System.Console.WriteLine("Insert Prenume:");
                string prenume = Console.ReadLine();
                System.Console.WriteLine("Insert facultate:");
                string facultate = Console.ReadLine();
                System.Console.WriteLine("Insert an studiu:");
                string an = Console.ReadLine();
                student.Nume      = nume;
                student.Prenume   = prenume;
                student.Facultate = facultate;
                student.An        = Convert.ToInt32(an);
                student.ETag      = "*";
                var updateOperation = TableOperation.Replace(student);
                await studentsTable.ExecuteAsync(updateOperation);

                System.Console.WriteLine("Record updated!");
            }
            else
            {
                System.Console.WriteLine("Record does not exists!");
            }
        }