Esempio n. 1
0
        public JsonResult Update(PZ_Client client)
        {
            PZ_Client editClient = db.PZ_Client.First(d => d.id == client.id);

            if (editClient.NameSort != client.NameSort)
            {
                editClient.NameSort = client.NameSort;
            }
            if (editClient.INN_UNN != client.INN_UNN)
            {
                editClient.INN_UNN = client.INN_UNN;
            }
            if (editClient.Name != client.Name)
            {
                editClient.Name = client.Name;
            }
            if (editClient.GCompany != client.GCompany)
            {
                editClient.GCompany = client.GCompany;
            }
            if (editClient.DCCompany != client.DCCompany)
            {
                editClient.DCCompany = client.DCCompany;
            }
            CorrectClient correctClient = new CorrectClient(editClient);

            editClient = correctClient.PZ_Client;
            db.Entry(editClient).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();

            return(Json(1, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public JsonResult Add(PZ_Client client)
        {
            CorrectClient correctClient = new CorrectClient(client);

            client = correctClient.PZ_Client;
            db.PZ_Client.Add(client);
            db.SaveChanges();

            return(Json(1, JsonRequestBehavior.AllowGet));
        }