Exemple #1
0
        public async Task <ActionResult <Class> > Post(Class Modify)
        {
            object encrypt = null;

            //User user = await db.Users.FirstOrDefaultAsync(x => x.Id == id);
            //Modify.
            if (Modify.Encrypts == null)
            {
                return(NotFound());
            }
            if (Modify.Encrypts != null)
            {
                //Encrypt.ToString();
                encrypt = await Encript_data.Encript_(Modify.Encrypts);
            }
            string path = "C:\\Temp\\employee.json.txt";

            using (TextWriter tw1 = new StreamWriter(path, true))
            {
                tw1.WriteLine(encrypt.ToString());
                tw1.Close();
            }

            return(new ObjectResult(encrypt));
        }
Exemple #2
0
        public async Task <ActionResult <Users> > Post(Users Modifys)
        {
            object encrypt = "";
            string ms;

            Console.WriteLine(Modifys.FirstNames);
            //User user = await db.Users.FirstOrDefaultAsync(x => x.Id == id);
            //Modify.
            if (Modifys.FirstNames == null)
            {
                return(NotFound());
            }
            if (Modifys.FirstNames != null)
            {
                encrypt = await Encript_data.Encript_(Modifys.FirstNames);
            }

            ms = Employee.Json_pars(FirstNames: encrypt.ToString(), LastName: Modifys.LastName, EmployeeID: Modifys.EmployeeID, Designation: Modifys.Designation);
            byte[]       byteArray = Encoding.UTF8.GetBytes(ms);
            MemoryStream stream    = new MemoryStream(byteArray);

            byte[] buffer = stream.ToArray();
            Console.WriteLine(buffer.GetValue(0));

            Employee.JSONDeserilaize(ms);
            return(new ObjectResult(ms));
        }