コード例 #1
0
        public bool UpdateClientPersons(ClientPersons client)
        {
            bool          res         = false;
            ClientPersons checkClient = db.ClientPersons.SingleOrDefault(x => x.id == client.id);

            if (checkClient != null)
            {
                try
                {
                    db.Entry(client).State = EntityState.Modified;
                    db.SaveChanges();
                    res = true;
                }
                catch { }
            }
            return(res);
        }
コード例 #2
0
        public bool CreateClientPerson(ClientPersons client)
        {
            bool          res          = false;
            ClientPersons checkCompany = db.ClientPersons.FirstOrDefault(x => x.id == client.id);

            if (checkCompany == null)
            {
                db.ClientPersons.Add(client);
                try
                {
                    db.SaveChanges();
                    res = true;
                }
                catch
                {
                    res = false;
                }
            }

            return(res);
        }