public void UpdateCustomerCode(tblCustomerReference customerReference) { string sqlQuery = @"UPDATE [dbo].[tblCustomerReference] SET [Name] ='" + customerReference.Name + @"',[CustomerCode] ='" + customerReference.CustomerCode + @"' WHERE ReferenceId =" + customerReference.ReferenceId; int noOfRowUpdated = _coreDBEntities.Database.ExecuteSqlCommand(sqlQuery); }
public tblCustomerReference AddCustomerReferenceCode(tblCustomerReference customerReference) { try { _coreDBEntities.Database.Connection.Open(); customerReference.CreatedBy = " Application"; customerReference.CreateDate = DateTime.Now; _coreDBEntities.tblCustomerReferences.Add(customerReference); _coreDBEntities.SaveChanges(); } catch (DbEntityValidationException ex) { } return(customerReference); }