Ejemplo n.º 1
0
        public JsonResult PostData(Client client)
        {
            Client dataClient = new Client();

            dataClient.Name      = client.Name;
            dataClient.LastName  = client.LastName;
            dataClient.Email     = client.Email;
            dataClient.Phone     = client.Phone;
            dataClient.URL       = client.URL;
            dataClient.BirthDate = client.BirthDate;
            dataClient.Address   = client.Address;

            if (client.Id > 0)
            {
                dataClient.Id = client.Id;
                db.Update(dataClient);
            }
            else
            {
                db.Add(dataClient);
            }

            return(Json("success", JsonRequestBehavior.AllowGet));
            //if (ModelState.IsValid)
            //{

            //}

            //return Json("error", JsonRequestBehavior.DenyGet);
        }